# nodes

node_type: n8n-nodes-base.Git
name: Git
display_name: Git
description: Control git.
category: transform
icon: file:git.svg
code_hash: 50ecff111cb4e7515e3a857d6d6c64da67db9cdb8bed00c31a04f424748b70ba
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:52
updated_at: 2025-06-08 09:17:52
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Git = void 0;
  const descriptions_1 = require("./descriptions");
  const simple_git_1 = __importDefault(require("simple-git"));
  const promises_1 = require("fs/promises");
  const url_1 = require("url");
  class Git {
      constructor() {
          this.description = {
              displayName: 'Git',
              name: 'git',
              icon: 'file:git.svg',
              group: ['transform'],
              version: 1,
              description: 'Control git.',
              defaults: {
                  name: 'Git',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'gitPassword',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['gitPassword'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Authenticate',
                              value: 'gitPassword',
                          },
                          {
                              name: 'None',
                              value: 'none',
                          },
                      ],
                      displayOptions: {
                          show: {
                              operation: ['clone', 'push'],
                          },
                      },
                      default: 'none',
                      description: 'The way to authenticate',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      default: 'log',
                      options: [
                          {
                              name: 'Add',
                              value: 'add',
                              description: 'Add a file or folder to commit',
                              action: 'Add a file or folder to commit',
                          },
                          {
                              name: 'Add Config',
                              value: 'addConfig',
                              description: 'Add configuration property',
                              action: 'Add configuration property',
                          },
                          {
                              name: 'Clone',
                              value: 'clone',
                              description: 'Clone a repository',
                              action: 'Clone a repository',
                          },
                          {
                              name: 'Commit',
                              value: 'commit',
                              description: 'Commit files or folders to git',
                              action: 'Commit files or folders to git',
                          },
                          {
                              name: 'Fetch',
                              value: 'fetch',
                              description: 'Fetch from remote repository',
                              action: 'Fetch from remote repository',
                          },
                          {
                              name: 'List Config',
                              value: 'listConfig',
                              description: 'Return current configuration',
                              action: 'Return current configuration',
                          },
                          {
                              name: 'Log',
                              value: 'log',
                              description: 'Return git commit history',
                              action: 'Return git commit history',
                          },
                          {
                              name: 'Pull',
                              value: 'pull',
                              description: 'Pull from remote repository',
                              action: 'Pull from remote repository',
                          },
                          {
                              name: 'Push',
                              value: 'push',
                              description: 'Push to remote repository',
                              action: 'Push to remote repository',
                          },
                          {
                              name: 'Push Tags',
                              value: 'pushTags',
                              description: 'Push Tags to remote repository',
                              action: 'Push tags to remote repository',
                          },
                          {
                              name: 'Status',
                              value: 'status',
                              description: 'Return status of current repository',
                              action: 'Return status of current repository',
                          },
                          {
                              name: 'Tag',
                              value: 'tag',
                              description: 'Create a new tag',
                              action: 'Create a new tag',
                          },
                          {
                              name: 'User Setup',
                              value: 'userSetup',
                              description: 'Set the user',
                              action: 'Set up a user',
                          },
                      ],
                  },
                  {
                      displayName: 'Repository Path',
                      name: 'repositoryPath',
                      type: 'string',
                      displayOptions: {
                          hide: {
                              operation: ['clone'],
                          },
                      },
                      default: '',
                      placeholder: '/tmp/repository',
                      required: true,
                      description: 'Local path of the git repository to operate on',
                  },
                  {
                      displayName: 'New Repository Path',
                      name: 'repositoryPath',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['clone'],
                          },
                      },
                      default: '',
                      placeholder: '/tmp/repository',
                      required: true,
                      description: 'Local path to which the git repository should be cloned into',
                  },
                  ...descriptions_1.addFields,
                  ...descriptions_1.addConfigFields,
                  ...descriptions_1.cloneFields,
                  ...descriptions_1.commitFields,
                  ...descriptions_1.logFields,
                  ...descriptions_1.pushFields,
                  ...descriptions_1.tagFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const prepareRepository = async (repositoryPath) => {
              const authentication = this.getNodeParameter('authentication', 0);
              if (authentication === 'gitPassword') {
                  const gitCredentials = await this.getCredentials('gitPassword');
                  const url = new url_1.URL(repositoryPath);
                  url.username = gitCredentials.username;
                  url.password = gitCredentials.password;
                  return url.toString();
              }
              return repositoryPath;
          };
          const operation = this.getNodeParameter('operation', 0);
          const returnItems = [];
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              try {
                  const repositoryPath = this.getNodeParameter('repositoryPath', itemIndex, '');
                  const options = this.getNodeParameter('options', itemIndex, {});
                  if (operation === 'clone') {
                      try {
                          await (0, promises_1.access)(repositoryPath);
                      }
                      catch (error) {
                          await (0, promises_1.mkdir)(repositoryPath);
                      }
                  }
                  const gitOptions = {
                      baseDir: repositoryPath,
                  };
                  const git = (0, simple_git_1.default)(gitOptions)
                      .env('GIT_TERMINAL_PROMPT', '0');
                  if (operation === 'add') {
                      const pathsToAdd = this.getNodeParameter('pathsToAdd', itemIndex, '');
                      await git.add(pathsToAdd.split(','));
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
                  else if (operation === 'addConfig') {
                      const key = this.getNodeParameter('key', itemIndex, '');
                      const value = this.getNodeParameter('value', itemIndex, '');
                      let append = false;
                      if (options.mode === 'append') {
                          append = true;
                      }
                      await git.addConfig(key, value, append);
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
                  else if (operation === 'clone') {
                      let sourceRepository = this.getNodeParameter('sourceRepository', itemIndex, '');
                      sourceRepository = await prepareRepository(sourceRepository);
                      await git.clone(sourceRepository, '.');
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
                  else if (operation === 'commit') {
                      const message = this.getNodeParameter('message', itemIndex, '');
                      let pathsToAdd = undefined;
                      if (options.files !== undefined) {
                          pathsToAdd = options.pathsToAdd.split(',');
                      }
                      await git.commit(message, pathsToAdd);
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
                  else if (operation === 'fetch') {
                      await git.fetch();
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
                  else if (operation === 'log') {
                      const logOptions = {};
                      const returnAll = this.getNodeParameter('returnAll', itemIndex, false);
                      if (!returnAll) {
                          logOptions.maxCount = this.getNodeParameter('limit', itemIndex, 100);
                      }
                      if (options.file) {
                          logOptions.file = options.file;
                      }
                      const log = await git.log(logOptions);
                      returnItems.push(...this.helpers.returnJsonArray(log.all).map((item) => {
                          return {
                              ...item,
                              pairedItem: { item: itemIndex },
                          };
                      }));
                  }
                  else if (operation === 'pull') {
                      await git.pull();
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
                  else if (operation === 'push') {
                      if (options.repository) {
                          const targetRepository = await prepareRepository(options.targetRepository);
                          await git.push(targetRepository);
                      }
                      else {
                          const authentication = this.getNodeParameter('authentication', 0);
                          if (authentication === 'gitPassword') {
                              const config = await git.listConfig();
                              let targetRepository;
                              for (const fileName of Object.keys(config.values)) {
                                  if (config.values[fileName]['remote.origin.url']) {
                                      targetRepository = config.values[fileName]['remote.origin.url'];
                                      break;
                                  }
                              }
                              targetRepository = await prepareRepository(targetRepository);
                              await git.push(targetRepository);
                          }
                          else {
                              await git.push();
                          }
                      }
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
                  else if (operation === 'pushTags') {
                      await git.pushTags();
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
                  else if (operation === 'listConfig') {
                      const config = await git.listConfig();
                      const data = [];
                      for (const fileName of Object.keys(config.values)) {
                          data.push({
                              _file: fileName,
                              ...config.values[fileName],
                          });
                      }
                      returnItems.push(...this.helpers.returnJsonArray(data).map((item) => {
                          return {
                              ...item,
                              pairedItem: { item: itemIndex },
                          };
                      }));
                  }
                  else if (operation === 'status') {
                      const status = await git.status();
                      returnItems.push(...this.helpers.returnJsonArray([status]).map((item) => {
                          return {
                              ...item,
                              pairedItem: { item: itemIndex },
                          };
                      }));
                  }
                  else if (operation === 'tag') {
                      const name = this.getNodeParameter('name', itemIndex, '');
                      await git.addTag(name);
                      returnItems.push({
                          json: {
                              success: true,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnItems.push({
                          json: {
                              error: error.toString(),
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnItems];
      }
  }
  exports.Git = Git;
  //# sourceMappingURL=Git.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"6131501a-f3c5-4f0f-b01b-0e15ca32d7a0","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"64337bb69e4972f4d79310bd199241d67717850d8dc3aa78475d6f501e8c6f3e"}}


node_type: n8n-nodes-base.GoToWebinar
name: GoToWebinar
display_name: GoToWebinar
description: Consume the GoToWebinar API
category: transform
icon: file:gotowebinar.svg
code_hash: 477c98f0558a9020e82b630957e1037aac792527cbe9a47e226875a9af67f884
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.gotowebinar
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:52
updated_at: 2025-06-08 09:17:52
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.GoToWebinar = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const descriptions_1 = require("./descriptions");
  const GenericFunctions_1 = require("./GenericFunctions");
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
  const omit_1 = __importDefault(require("lodash/omit"));
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class GoToWebinar {
      constructor() {
          this.description = {
              displayName: 'GoToWebinar',
              name: 'goToWebinar',
              icon: 'file:gotowebinar.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the GoToWebinar API',
              defaults: {
                  name: 'GoToWebinar',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'goToWebinarOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Attendee',
                              value: 'attendee',
                          },
                          {
                              name: 'Co-Organizer',
                              value: 'coorganizer',
                          },
                          {
                              name: 'Panelist',
                              value: 'panelist',
                          },
                          {
                              name: 'Registrant',
                              value: 'registrant',
                          },
                          {
                              name: 'Session',
                              value: 'session',
                          },
                          {
                              name: 'Webinar',
                              value: 'webinar',
                          },
                      ],
                      default: 'attendee',
                  },
                  ...descriptions_1.attendeeOperations,
                  ...descriptions_1.attendeeFields,
                  ...descriptions_1.coorganizerOperations,
                  ...descriptions_1.coorganizerFields,
                  ...descriptions_1.panelistOperations,
                  ...descriptions_1.panelistFields,
                  ...descriptions_1.registrantOperations,
                  ...descriptions_1.registrantFields,
                  ...descriptions_1.sessionOperations,
                  ...descriptions_1.sessionFields,
                  ...descriptions_1.webinarOperations,
                  ...descriptions_1.webinarFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getWebinars() {
                      return GenericFunctions_1.loadWebinars.call(this);
                  },
                  async getAnswers() {
                      return GenericFunctions_1.loadAnswers.call(this);
                  },
                  async getWebinarSessions() {
                      return GenericFunctions_1.loadWebinarSessions.call(this);
                  },
                  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 getRegistranSimpleQuestions() {
                      return GenericFunctions_1.loadRegistranSimpleQuestions.call(this);
                  },
                  async getRegistranMultiChoiceQuestions() {
                      return GenericFunctions_1.loadRegistranMultiChoiceQuestions.call(this);
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          const returnData = [];
          const { oauthTokenData } = (await this.getCredentials('goToWebinarOAuth2Api'));
          const accountKey = oauthTokenData.account_key;
          const organizerKey = oauthTokenData.organizer_key;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'attendee') {
                      if (operation === 'get') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const sessionKey = this.getNodeParameter('sessionKey', i);
                          const registrantKey = this.getNodeParameter('registrantKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/attendees/${registrantKey}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
                      }
                      else if (operation === 'getAll') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const sessionKey = this.getNodeParameter('sessionKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/attendees`;
                          responseData = await GenericFunctions_1.handleGetAll.call(this, endpoint, {}, {}, resource);
                      }
                      else if (operation === 'getDetails') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const sessionKey = this.getNodeParameter('sessionKey', i);
                          const registrantKey = this.getNodeParameter('registrantKey', i);
                          const details = this.getNodeParameter('details', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/attendees/${registrantKey}/${details}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
                      }
                  }
                  else if (resource === 'coorganizer') {
                      if (operation === 'create') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const body = {
                              external: this.getNodeParameter('isExternal', i),
                          };
                          if (body.external === false) {
                              body.organizerKey = this.getNodeParameter('organizerKey', i);
                          }
                          if (body.external === true) {
                              body.givenName = this.getNodeParameter('givenName', i);
                              body.email = this.getNodeParameter('email', i);
                          }
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/coorganizers`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'POST', endpoint, {}, [body]);
                      }
                      else if (operation === 'delete') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const coorganizerKey = this.getNodeParameter('coorganizerKey', i);
                          const qs = {
                              external: this.getNodeParameter('isExternal', i),
                          };
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/coorganizers/${coorganizerKey}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'DELETE', endpoint, qs, {});
                          responseData = { success: true };
                      }
                      else if (operation === 'getAll') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/coorganizers`;
                          responseData = await GenericFunctions_1.handleGetAll.call(this, endpoint, {}, {}, resource);
                      }
                      else if (operation === 'reinvite') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const coorganizerKey = this.getNodeParameter('coorganizerKey', i);
                          const qs = {
                              external: this.getNodeParameter('isExternal', i),
                          };
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/coorganizers/${coorganizerKey}/resendInvitation`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'POST', endpoint, qs, {});
                          responseData = { success: true };
                      }
                  }
                  else if (resource === 'panelist') {
                      if (operation === 'create') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const body = [
                              {
                                  name: this.getNodeParameter('name', i),
                                  email: this.getNodeParameter('email', i),
                              },
                          ];
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/panelists`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'POST', endpoint, {}, body);
                      }
                      else if (operation === 'delete') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const panelistKey = this.getNodeParameter('panelistKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/panelists/${panelistKey}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'DELETE', endpoint, {}, {});
                          responseData = { success: true };
                      }
                      else if (operation === 'getAll') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/panelists`;
                          responseData = await GenericFunctions_1.handleGetAll.call(this, endpoint, {}, {}, resource);
                      }
                      else if (operation === 'reinvite') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const panelistKey = this.getNodeParameter('panelistKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/panelists/${panelistKey}/resendInvitation`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'POST', endpoint, {}, {});
                          responseData = { success: true };
                      }
                  }
                  else if (resource === 'registrant') {
                      if (operation === 'create') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const qs = {};
                          const body = {
                              firstName: this.getNodeParameter('firstName', i),
                              lastName: this.getNodeParameter('lastName', i),
                              email: this.getNodeParameter('email', i),
                              responses: [],
                          };
                          let additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.resendConfirmation) {
                              qs.resendConfirmation = additionalFields.resendConfirmation;
                              additionalFields = (0, omit_1.default)(additionalFields, ['resendConfirmation']);
                          }
                          if (additionalFields.fullAddress) {
                              Object.assign(body, additionalFields.fullAddress.details);
                              additionalFields = (0, omit_1.default)(additionalFields, ['fullAddress']);
                          }
                          if (additionalFields.simpleResponses) {
                              body.responses.push(...additionalFields.simpleResponses.details);
                              additionalFields = (0, omit_1.default)(additionalFields, ['simpleResponses']);
                          }
                          if (additionalFields.multiChoiceResponses) {
                              body.responses.push(...additionalFields.multiChoiceResponses.details);
                              additionalFields = (0, omit_1.default)(additionalFields, ['multiChoiceResponses']);
                          }
                          Object.assign(body, additionalFields);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/registrants`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'POST', endpoint, qs, body);
                      }
                      else if (operation === 'delete') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const registrantKey = this.getNodeParameter('registrantKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/registrants/${registrantKey}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'DELETE', endpoint, {}, {});
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const registrantKey = this.getNodeParameter('registrantKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/registrants/${registrantKey}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
                      }
                      else if (operation === 'getAll') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/registrants`;
                          responseData = await GenericFunctions_1.handleGetAll.call(this, endpoint, {}, {}, resource);
                      }
                  }
                  else if (resource === 'session') {
                      if (operation === 'get') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const sessionKey = this.getNodeParameter('sessionKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              qs.limit = this.getNodeParameter('limit', 0);
                          }
                          const { webinarKey, times } = this.getNodeParameter('additionalFields', i);
                          if (times) {
                              qs.fromTime = (0, moment_timezone_1.default)(times.timesProperties.fromTime).format();
                              qs.toTime = (0, moment_timezone_1.default)(times.timesProperties.toTime).format();
                          }
                          else {
                              qs.fromTime = (0, moment_timezone_1.default)().subtract(1, 'years').format();
                              qs.toTime = (0, moment_timezone_1.default)().format();
                          }
                          if (webinarKey !== undefined) {
                              const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions`;
                              responseData = await GenericFunctions_1.goToWebinarApiRequestAllItems.call(this, 'GET', endpoint, qs, {}, resource);
                          }
                          else {
                              const endpoint = `organizers/${organizerKey}/sessions`;
                              responseData = await GenericFunctions_1.goToWebinarApiRequestAllItems.call(this, 'GET', endpoint, qs, {}, resource);
                          }
                      }
                      else if (operation === 'getDetails') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const sessionKey = this.getNodeParameter('sessionKey', i);
                          const details = this.getNodeParameter('details', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}/sessions/${sessionKey}/${details}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
                      }
                  }
                  else if (resource === 'webinar') {
                      if (operation === 'create') {
                          const timesProperties = this.getNodeParameter('times.timesProperties', i, []);
                          const body = {
                              subject: this.getNodeParameter('subject', i),
                              times: timesProperties,
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const endpoint = `organizers/${organizerKey}/webinars`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'POST', endpoint, {}, body);
                      }
                      else if (operation === 'delete') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const { sendCancellationEmails } = this.getNodeParameter('additionalFields', i);
                          const qs = {};
                          if (sendCancellationEmails) {
                              qs.sendCancellationEmails = sendCancellationEmails;
                          }
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}`;
                          await GenericFunctions_1.goToWebinarApiRequest.call(this, 'DELETE', endpoint, qs, {});
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequest.call(this, 'GET', endpoint, {}, {});
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              qs.limit = this.getNodeParameter('limit', 0);
                          }
                          const { times } = this.getNodeParameter('additionalFields', i);
                          if (times) {
                              qs.fromTime = (0, moment_timezone_1.default)(times.timesProperties.fromTime).format();
                              qs.toTime = (0, moment_timezone_1.default)(times.timesProperties.toTime).format();
                          }
                          else {
                              qs.fromTime = (0, moment_timezone_1.default)().subtract(1, 'years').format();
                              qs.toTime = (0, moment_timezone_1.default)().format();
                          }
                          const endpoint = `accounts/${accountKey}/webinars`;
                          responseData = await GenericFunctions_1.goToWebinarApiRequestAllItems.call(this, 'GET', endpoint, qs, {}, resource);
                      }
                      else if (operation === 'update') {
                          const webinarKey = this.getNodeParameter('webinarKey', i);
                          const qs = {
                              notifyParticipants: this.getNodeParameter('notifyParticipants', i),
                          };
                          let body = {};
                          let updateFields = this.getNodeParameter('updateFields', i);
                          if (updateFields.times) {
                              const { times } = updateFields;
                              body = {
                                  times: times.timesProperties,
                              };
                              updateFields = (0, omit_1.default)(updateFields, ['times']);
                          }
                          Object.assign(body, updateFields);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}`;
                          await GenericFunctions_1.goToWebinarApiRequest.call(this, 'PUT', endpoint, qs, body);
                          responseData = { success: true };
                      }
                  }
              }
              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.GoToWebinar = GoToWebinar;
  //# sourceMappingURL=GoToWebinar.node.js.map

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

  # GoToWebinar node

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

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

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

  ## Operations

  * Attendee
      * Get
      * Get All
      * Get Details
  * Co-Organizer
      * Create
      * Delete
      * Get All
      * Re-invite
  * Panelist
      * Create
      * Delete
      * Get All
      * Re-invite
  * Registrant
      * Create
      * Delete
      * Get
      * Get All
  * Session
      * Get
      * Get All
      * Get Details
  * Webinar
      * 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, 'gotowebinar') ]]

  --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":"f5e11e5d-a65f-4fcd-b91a-8e039c369fcf","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"7bc5da43f3862a4ee92cb0c68ecdc8d74b531bf85ea5d7fb7d709f6325df0ba7"}}


node_type: n8n-nodes-base.GSuiteAdmin
name: GSuiteAdmin
display_name: Google Workspace Admin
description: Consume Google Workspace Admin API
category: input
icon: file:google-workspace-admin.png
code_hash: f071a02014ea9f596115099ea9f2240ac048a4dd7802ef3d9e499d28cbfc2d21
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.gsuiteadmin
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:56
updated_at: 2025-06-08 09:17:56
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.GSuiteAdmin = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const UserDescription_1 = require("./UserDescription");
  const GroupDescripion_1 = require("./GroupDescripion");
  class GSuiteAdmin {
      constructor() {
          this.description = {
              displayName: 'Google Workspace Admin',
              name: 'gSuiteAdmin',
              icon: 'file:google-workspace-admin.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Google Workspace Admin API',
              defaults: {
                  name: 'Google Workspace Admin',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'gSuiteAdminOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Group',
                              value: 'group',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'user',
                  },
                  ...GroupDescripion_1.groupOperations,
                  ...GroupDescripion_1.groupFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getDomains() {
                      const returnData = [];
                      const domains = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'domains', 'GET', '/directory/v1/customer/my_customer/domains');
                      for (const domain of domains) {
                          const domainName = domain.domainName;
                          const domainId = domain.domainName;
                          returnData.push({
                              name: domainName,
                              value: domainId,
                          });
                      }
                      return returnData;
                  },
                  async getSchemas() {
                      const returnData = [];
                      const schemas = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'schemas', 'GET', '/directory/v1/customer/my_customer/schemas');
                      for (const schema of schemas) {
                          const schemaName = schema.displayName;
                          const schemaId = schema.schemaName;
                          returnData.push({
                              name: schemaName,
                              value: schemaId,
                          });
                      }
                      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 === 'group') {
                  if (operation === 'create') {
                      const email = this.getNodeParameter('email', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          email,
                      };
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.googleApiRequest.call(this, 'POST', '/directory/v1/groups', body);
                  }
                  if (operation === 'delete') {
                      const groupId = this.getNodeParameter('groupId', i);
                      responseData = await GenericFunctions_1.googleApiRequest.call(this, 'DELETE', `/directory/v1/groups/${groupId}`, {});
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const groupId = this.getNodeParameter('groupId', i);
                      responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', `/directory/v1/groups/${groupId}`, {});
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      Object.assign(qs, options);
                      if (qs.customer === undefined) {
                          qs.customer = 'my_customer';
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'groups', 'GET', '/directory/v1/groups', {}, qs);
                      }
                      else {
                          qs.maxResults = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/directory/v1/groups', {}, qs);
                          responseData = responseData.groups;
                      }
                  }
                  if (operation === 'update') {
                      const groupId = this.getNodeParameter('groupId', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const body = {};
                      Object.assign(body, updateFields);
                      responseData = await GenericFunctions_1.googleApiRequest.call(this, 'PUT', `/directory/v1/groups/${groupId}`, body);
                  }
              }
              if (resource === 'user') {
                  if (operation === 'create') {
                      const domain = this.getNodeParameter('domain', i);
                      const firstName = this.getNodeParameter('firstName', i);
                      const lastName = this.getNodeParameter('lastName', i);
                      const password = this.getNodeParameter('password', i);
                      const username = this.getNodeParameter('username', i);
                      const makeAdmin = this.getNodeParameter('makeAdmin', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          name: {
                              familyName: lastName,
                              givenName: firstName,
                          },
                          password,
                          primaryEmail: `${username}@${domain}`,
                      };
                      Object.assign(body, additionalFields);
                      if (additionalFields.phoneUi) {
                          const phones = additionalFields.phoneUi.phoneValues;
                          body.phones = phones;
                          delete body.phoneUi;
                      }
                      if (additionalFields.emailUi) {
                          const emails = additionalFields.emailUi.emailValues;
                          body.emails = emails;
                          delete body.emailUi;
                      }
                      responseData = await GenericFunctions_1.googleApiRequest.call(this, 'POST', '/directory/v1/users', body, qs);
                      if (makeAdmin) {
                          await GenericFunctions_1.googleApiRequest.call(this, 'POST', `/directory/v1/users/${responseData.id}/makeAdmin`, { status: true });
                          responseData.isAdmin = true;
                      }
                  }
                  if (operation === 'delete') {
                      const userId = this.getNodeParameter('userId', i);
                      responseData = await GenericFunctions_1.googleApiRequest.call(this, 'DELETE', `/directory/v1/users/${userId}`, {});
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const userId = this.getNodeParameter('userId', i);
                      const projection = this.getNodeParameter('projection', i);
                      const options = this.getNodeParameter('options', i);
                      qs.projection = projection;
                      Object.assign(qs, options);
                      if (qs.customFieldMask) {
                          qs.customFieldMask = qs.customFieldMask.join(' ');
                      }
                      if (qs.projection === 'custom' && qs.customFieldMask === undefined) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'When projection is set to custom, the custom schemas field must be defined', { itemIndex: i });
                      }
                      responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', `/directory/v1/users/${userId}`, {}, qs);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const projection = this.getNodeParameter('projection', i);
                      const options = this.getNodeParameter('options', i);
                      qs.projection = projection;
                      Object.assign(qs, options);
                      if (qs.customer === undefined) {
                          qs.customer = 'my_customer';
                      }
                      if (qs.customFieldMask) {
                          qs.customFieldMask = qs.customFieldMask.join(' ');
                      }
                      if (qs.projection === 'custom' && qs.customFieldMask === undefined) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'When projection is set to custom, the custom schemas field must be defined', { itemIndex: i });
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'users', 'GET', '/directory/v1/users', {}, qs);
                      }
                      else {
                          qs.maxResults = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/directory/v1/users', {}, qs);
                          responseData = responseData.users;
                      }
                  }
                  if (operation === 'update') {
                      const userId = this.getNodeParameter('userId', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const body = { name: {} };
                      Object.assign(body, updateFields);
                      if (updateFields.firstName) {
                          body.name.givenName = updateFields.firstName;
                          delete body.firstName;
                      }
                      if (updateFields.lastName) {
                          body.name.familyName = updateFields.lastName;
                          delete body.lastName;
                      }
                      if (Object.keys(body.name).length === 0) {
                          delete body.name;
                      }
                      if (updateFields.phoneUi) {
                          const phones = updateFields.phoneUi.phoneValues;
                          body.phones = phones;
                          delete body.phoneUi;
                      }
                      if (updateFields.emailUi) {
                          const emails = updateFields.emailUi.emailValues;
                          body.emails = emails;
                          delete body.emailUi;
                      }
                      responseData = await GenericFunctions_1.googleApiRequest.call(this, 'PUT', `/directory/v1/users/${userId}`, body, qs);
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.GSuiteAdmin = GSuiteAdmin;
  //# sourceMappingURL=GSuiteAdmin.node.js.map

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

  # Google Workspace Admin node

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

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

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

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

  ## Operations

  * Group
      * Create a group
      * Delete a group
      * Get a group
      * Get all groups
      * Update a group
  * User
      * Create a user
      * Delete a user
      * Get a user
      * Get 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, 'google-workspace-admin') ]]

  ## How to project a user's information

  There are three different ways to project a user's information:

  - **Basic**: Doesn't include any custom fields.
  - **Custom**: Includes the custom fields from schemas in `customField`.
  - **Full**: Include all the fields associated with the user.

  To include custom fields, follow these steps:

  1. Select **Custom** from the **Projection** dropdown list.
  2. Select the **Add Options** button and select **Custom Schemas** from the dropdown list.
  3. Select the schema names you want to include from the **Custom Schemas** dropdown list.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"d1fd7602-8229-4781-9158-e50d7801415e","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"9ec57a268d82730077a9a666bdc63eca9db50d9e22deaeda616bd5cd61759af1"}}


node_type: n8n-nodes-base.Gmail
name: Gmail
display_name: Gmail
description: Consume the Gmail API
category: transform
icon: file:gmail.svg
code_hash: 778830fab42a07b1a235be83dedadc666da237bc40fda6257ed59e3c102fdbbe
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 09:17:56
updated_at: 2025-06-08 09:17:56
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Gmail = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GmailV1_node_1 = require("./v1/GmailV1.node");
  const GmailV2_node_1 = require("./v2/GmailV2.node");
  class Gmail extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Gmail',
              name: 'gmail',
              icon: 'file:gmail.svg',
              group: ['transform'],
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Gmail API',
              defaultVersion: 2.1,
          };
          const nodeVersions = {
              1: new GmailV1_node_1.GmailV1(baseDescription),
              2: new GmailV2_node_1.GmailV2(baseDescription),
              2.1: new GmailV2_node_1.GmailV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.Gmail = Gmail;
  //# sourceMappingURL=Gmail.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"5c30ea0d-d9ec-4d2c-af4c-7d99d138e383","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"2b451a0efe1bfd40e066470c37ad920d369f9f9d580d565b017f74d4f58de889"}}


node_type: n8n-nodes-base.Grafana
name: Grafana
display_name: Grafana
description: Consume the Grafana API
category: transform
icon: file:grafana.svg
code_hash: 95682e6de4432f32165ece9a16ca1a7af19369715ee5993df156d8c95acbe80f
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.grafana
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:59
updated_at: 2025-06-08 09:17:59
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Grafana = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  class Grafana {
      constructor() {
          this.description = {
              displayName: 'Grafana',
              name: 'grafana',
              icon: 'file:grafana.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Grafana API',
              defaults: {
                  name: 'Grafana',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'grafanaApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      noDataExpression: true,
                      type: 'options',
                      options: [
                          {
                              name: 'Dashboard',
                              value: 'dashboard',
                          },
                          {
                              name: 'Team',
                              value: 'team',
                          },
                          {
                              name: 'Team Member',
                              value: 'teamMember',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'dashboard',
                  },
                  ...descriptions_1.dashboardOperations,
                  ...descriptions_1.dashboardFields,
                  ...descriptions_1.teamOperations,
                  ...descriptions_1.teamFields,
                  ...descriptions_1.teamMemberOperations,
                  ...descriptions_1.teamMemberFields,
                  ...descriptions_1.userOperations,
                  ...descriptions_1.userFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getDashboards() {
                      const dashboards = (await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', '/search', {}, { qs: 'dash-db' }));
                      return dashboards.map(({ id, title }) => ({ value: id, name: title }));
                  },
                  async getFolders() {
                      const folders = (await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', '/folders'));
                      return folders.map(({ id, title }) => ({ value: id, name: title }));
                  },
                  async getTeams() {
                      const res = (await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', '/teams/search'));
                      return res.teams.map(({ id, name }) => ({ value: id, name }));
                  },
                  async getUsers() {
                      const users = (await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', '/org/users'));
                      return users.map(({ userId, email }) => ({ value: userId, name: email }));
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'dashboard') {
                      if (operation === 'create') {
                          const body = {
                              dashboard: {
                                  id: null,
                                  title: this.getNodeParameter('title', i),
                              },
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              if (additionalFields.folderId === '')
                                  delete additionalFields.folderId;
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'POST', '/dashboards/db', body);
                      }
                      else if (operation === 'delete') {
                          const uidOrUrl = this.getNodeParameter('dashboardUidOrUrl', i);
                          const uid = GenericFunctions_1.deriveUid.call(this, uidOrUrl);
                          const endpoint = `/dashboards/uid/${uid}`;
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const uidOrUrl = this.getNodeParameter('dashboardUidOrUrl', i);
                          const uid = GenericFunctions_1.deriveUid.call(this, uidOrUrl);
                          const endpoint = `/dashboards/uid/${uid}`;
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          const qs = {
                              type: 'dash-db',
                          };
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, filters);
                          }
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              Object.assign(qs, { limit });
                          }
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', '/search', {}, qs);
                      }
                      else if (operation === 'update') {
                          const uidOrUrl = this.getNodeParameter('dashboardUidOrUrl', i);
                          const uid = GenericFunctions_1.deriveUid.call(this, uidOrUrl);
                          await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', `/dashboards/uid/${uid}`);
                          const body = {
                              overwrite: true,
                              dashboard: { uid },
                          };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.throwOnEmptyUpdate.call(this, resource, updateFields);
                          const { title, ...rest } = updateFields;
                          if (!title) {
                              const { dashboard } = await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', `/dashboards/uid/${uid}`);
                              body.dashboard.title = dashboard.title;
                          }
                          else {
                              const dashboards = (await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', '/search'));
                              const titles = dashboards.map(({ title: entry }) => entry);
                              if (titles.includes(title)) {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
                                      message: 'A dashboard with the same name already exists in the selected folder',
                                  });
                              }
                              body.dashboard.title = title;
                          }
                          if (title) {
                              body.dashboard.title = title;
                          }
                          if (Object.keys(rest).length) {
                              if (rest.folderId === '')
                                  delete rest.folderId;
                              Object.assign(body, rest);
                          }
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'POST', '/dashboards/db', body);
                      }
                  }
                  else if (resource === 'team') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'POST', '/teams', body);
                      }
                      else if (operation === 'delete') {
                          const teamId = this.getNodeParameter('teamId', i);
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'DELETE', `/teams/${teamId}`);
                      }
                      else if (operation === 'get') {
                          const teamId = this.getNodeParameter('teamId', i);
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', `/teams/${teamId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, filters);
                          }
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', '/teams/search', {}, qs);
                          responseData = responseData.teams;
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                      else if (operation === 'update') {
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.throwOnEmptyUpdate.call(this, resource, updateFields);
                          const body = {};
                          const teamId = this.getNodeParameter('teamId', i);
                          await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', `/teams/${teamId}`);
                          if (!updateFields.email) {
                              const { email } = await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', `/teams/${teamId}`);
                              body.email = email;
                          }
                          if (Object.keys(updateFields).length) {
                              Object.assign(body, updateFields);
                          }
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'PUT', `/teams/${teamId}`, body);
                      }
                  }
                  else if (resource === 'teamMember') {
                      if (operation === 'add') {
                          const userId = this.getNodeParameter('userId', i);
                          const body = {
                              userId: parseInt(userId, 10),
                          };
                          const teamId = this.getNodeParameter('teamId', i);
                          const endpoint = `/teams/${teamId}/members`;
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'POST', endpoint, body);
                      }
                      else if (operation === 'remove') {
                          const teamId = this.getNodeParameter('teamId', i);
                          const memberId = this.getNodeParameter('memberId', i);
                          const endpoint = `/teams/${teamId}/members/${memberId}`;
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'getAll') {
                          const teamId = this.getNodeParameter('teamId', i);
                          await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', `/teams/${teamId}`);
                          const endpoint = `/teams/${teamId}/members`;
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', endpoint);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'create') {
                          const body = {
                              role: this.getNodeParameter('role', i),
                              loginOrEmail: this.getNodeParameter('loginOrEmail', i),
                          };
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'POST', '/org/users', body);
                      }
                      else if (operation === 'delete') {
                          const userId = this.getNodeParameter('userId', i);
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'DELETE', `/org/users/${userId}`);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'GET', '/org/users');
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.throwOnEmptyUpdate.call(this, resource, updateFields);
                          if (Object.keys(updateFields).length) {
                              Object.assign(body, updateFields);
                          }
                          const userId = this.getNodeParameter('userId', i);
                          responseData = await GenericFunctions_1.grafanaApiRequest.call(this, 'PATCH', `/org/users/${userId}`, body);
                      }
                  }
                  Array.isArray(responseData)
                      ? returnData.push(...responseData)
                      : returnData.push(responseData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Grafana = Grafana;
  //# sourceMappingURL=Grafana.node.js.map

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

  # Grafana node

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

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

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

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

  ## Operations

  * Dashboard
      * Create a dashboard
      * Delete a dashboard
      * Get a dashboard
      * Get all dashboards
      * Update a dashboard
  * Team
      * Create a team
      * Delete a team
      * Get a team
      * Retrieve all teams
      * Update a team
  * Team Member
      * Add a member to a team
      * Retrieve all team members
      * Remove a member from a team
  * User
      * Delete a user from the current organization
      * Retrieve all users in the current organization
      * Update a user in the current organization

  ## Templates and examples

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

  --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":"601c0e7a-c7e3-450f-90f4-05c75d611fe2","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"716a4398cd3a4dd5eed94c8a5b70ef7dd62b864cda4d508de6dc0607dfa40a44"}}


node_type: n8n-nodes-base.Gotify
name: Gotify
display_name: Gotify
description: Consume Gotify API
category: input
icon: file:gotify.png
code_hash: a3f8bbf0c942d4fce2b47cb39956d8f3ac03218d4307e9f794f4ef07f72bbb76
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.gotify
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:59
updated_at: 2025-06-08 09:17:59
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Gotify = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Gotify {
      constructor() {
          this.description = {
              displayName: 'Gotify',
              name: 'gotify',
              icon: 'file:gotify.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Gotify API',
              defaults: {
                  name: 'Gotify',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'gotifyApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Message',
                              value: 'message',
                          },
                      ],
                      default: 'message',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              action: 'Create a message',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              action: 'Delete a message',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              action: 'Get many messages',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['create'],
                          },
                      },
                      default: '',
                      description: 'The message. Markdown (excluding html) is allowed.',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['create'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Priority',
                              name: 'priority',
                              type: 'number',
                              default: 1,
                              description: 'The priority of the message',
                          },
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              default: '',
                              description: 'The title of the message',
                          },
                      ],
                  },
                  {
                      displayName: 'Message ID',
                      name: 'messageId',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['delete'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      description: 'Max number of results to return',
                      default: 20,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'message') {
                      if (operation === 'create') {
                          const message = this.getNodeParameter('message', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              message,
                          };
                          Object.assign(body, additionalFields);
                          responseData = await GenericFunctions_1.gotifyApiRequest.call(this, 'POST', '/message', body);
                      }
                      if (operation === 'delete') {
                          const messageId = this.getNodeParameter('messageId', i);
                          responseData = await GenericFunctions_1.gotifyApiRequest.call(this, 'DELETE', `/message/${messageId}`);
                          responseData = { success: true };
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.gotifyApiRequestAllItems.call(this, 'messages', 'GET', '/message', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.gotifyApiRequest.call(this, 'GET', '/message', {}, qs);
                              responseData = responseData.messages;
                          }
                      }
                  }
                  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.Gotify = Gotify;
  //# sourceMappingURL=Gotify.node.js.map

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

  # Gotify node

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

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

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

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

  ## Operations

  * Message
      * Create
      * Delete
      * Get All

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"c3f69b2f-e2d8-4a80-af20-95a1ff47b1ae","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"857ec0f6d79aed1523a00c6162a955fadc84282182817ad15960bb6681522cdb"}}


node_type: n8n-nodes-base.YouTube
name: YouTube
display_name: YouTube
description: Consume YouTube API
category: input
icon: file:youTube.png
code_hash: f834b8bd47ceff5c44239f11db43a05b8839404dd4001472a33e5aad9cb7e619
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.youtube
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:59
updated_at: 2025-06-08 09:17:59
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.YouTube = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const ChannelDescription_1 = require("./ChannelDescription");
  const PlaylistDescription_1 = require("./PlaylistDescription");
  const PlaylistItemDescription_1 = require("./PlaylistItemDescription");
  const VideoDescription_1 = require("./VideoDescription");
  const VideoCategoryDescription_1 = require("./VideoCategoryDescription");
  const CountryCodes_1 = require("./CountryCodes");
  const UPLOAD_CHUNK_SIZE = 1024 * 1024;
  class YouTube {
      constructor() {
          this.description = {
              displayName: 'YouTube',
              name: 'youTube',
              icon: 'file:youTube.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume YouTube API',
              defaults: {
                  name: 'YouTube',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'youTubeOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Channel',
                              value: 'channel',
                          },
                          {
                              name: 'Playlist',
                              value: 'playlist',
                          },
                          {
                              name: 'Playlist Item',
                              value: 'playlistItem',
                          },
                          {
                              name: 'Video',
                              value: 'video',
                          },
                          {
                              name: 'Video Category',
                              value: 'videoCategory',
                          },
                      ],
                      default: 'channel',
                  },
                  ...ChannelDescription_1.channelOperations,
                  ...ChannelDescription_1.channelFields,
                  ...PlaylistDescription_1.playlistOperations,
                  ...PlaylistDescription_1.playlistFields,
                  ...PlaylistItemDescription_1.playlistItemOperations,
                  ...PlaylistItemDescription_1.playlistItemFields,
                  ...VideoDescription_1.videoOperations,
                  ...VideoDescription_1.videoFields,
                  ...VideoCategoryDescription_1.videoCategoryOperations,
                  ...VideoCategoryDescription_1.videoCategoryFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLanguages() {
                      const returnData = [];
                      const languages = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'items', 'GET', '/youtube/v3/i18nLanguages');
                      for (const language of languages) {
                          const languageName = language.id.toUpperCase();
                          const languageId = language.id;
                          returnData.push({
                              name: languageName,
                              value: languageId,
                          });
                      }
                      return returnData;
                  },
                  async getCountriesCodes() {
                      const returnData = [];
                      for (const countryCode of CountryCodes_1.countriesCodes) {
                          const countryCodeName = `${countryCode.name} - ${countryCode.alpha2}`;
                          const countryCodeId = countryCode.alpha2;
                          returnData.push({
                              name: countryCodeName,
                              value: countryCodeId,
                          });
                      }
                      return returnData;
                  },
                  async getVideoCategories() {
                      const countryCode = this.getCurrentNodeParameter('regionCode');
                      const returnData = [];
                      const qs = {};
                      qs.regionCode = countryCode;
                      qs.part = 'snippet';
                      const categories = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'items', 'GET', '/youtube/v3/videoCategories', {}, qs);
                      for (const category of categories) {
                          const categoryName = category.snippet.title;
                          const categoryId = category.id;
                          returnData.push({
                              name: categoryName,
                              value: categoryId,
                          });
                      }
                      return returnData;
                  },
                  async getPlaylists() {
                      const returnData = [];
                      const qs = {};
                      qs.part = 'snippet';
                      qs.mine = true;
                      const playlists = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'items', 'GET', '/youtube/v3/playlists', {}, qs);
                      for (const playlist of playlists) {
                          const playlistName = playlist.snippet.title;
                          const playlistId = playlist.id;
                          returnData.push({
                              name: playlistName,
                              value: playlistId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          var _a, _b, _c, _d;
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'channel') {
                      if (operation === 'get') {
                          let part = this.getNodeParameter('part', i);
                          const channelId = this.getNodeParameter('channelId', i);
                          if (part.includes('*')) {
                              part = [
                                  'brandingSettings',
                                  'contentDetails',
                                  'contentOwnerDetails',
                                  'id',
                                  'localizations',
                                  'snippet',
                                  'statistics',
                                  'status',
                                  'topicDetails',
                              ];
                          }
                          qs.part = part.join(',');
                          qs.id = channelId;
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/channels', {}, qs);
                          responseData = responseData.items;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          let part = this.getNodeParameter('part', i);
                          const options = this.getNodeParameter('options', i);
                          const filters = this.getNodeParameter('filters', i);
                          if (part.includes('*')) {
                              part = [
                                  'brandingSettings',
                                  'contentDetails',
                                  'contentOwnerDetails',
                                  'id',
                                  'localizations',
                                  'snippet',
                                  'statistics',
                                  'status',
                                  'topicDetails',
                              ];
                          }
                          qs.part = part.join(',');
                          Object.assign(qs, options, filters);
                          qs.mine = true;
                          if (qs.categoryId || qs.forUsername || qs.id || qs.managedByMe) {
                              delete qs.mine;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'items', 'GET', '/youtube/v3/channels', {}, qs);
                          }
                          else {
                              qs.maxResults = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/channels', {}, qs);
                              responseData = responseData.items;
                          }
                      }
                      if (operation === 'update') {
                          const channelId = this.getNodeParameter('channelId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {
                              id: channelId,
                              brandingSettings: {
                                  channel: {},
                                  image: {},
                              },
                          };
                          qs.part = 'brandingSettings';
                          if (updateFields.onBehalfOfContentOwner) {
                              qs.onBehalfOfContentOwner = updateFields.onBehalfOfContentOwner;
                          }
                          if (updateFields.brandingSettingsUi) {
                              const channelSettingsValues = updateFields.brandingSettingsUi
                                  .channelSettingsValues;
                              const channelSettings = {};
                              if (channelSettingsValues === null || channelSettingsValues === void 0 ? void 0 : channelSettingsValues.channel) {
                                  const channelSettingsOptions = channelSettingsValues.channel;
                                  if (channelSettingsOptions.country) {
                                      channelSettings.country = channelSettingsOptions.country;
                                  }
                                  if (channelSettingsOptions.description) {
                                      channelSettings.description = channelSettingsOptions.description;
                                  }
                                  if (channelSettingsOptions.defaultLanguage) {
                                      channelSettings.defaultLanguage = channelSettingsOptions.defaultLanguage;
                                  }
                                  if (channelSettingsOptions.defaultTab) {
                                      channelSettings.defaultTab = channelSettingsOptions.defaultTab;
                                  }
                                  if (channelSettingsOptions.featuredChannelsTitle) {
                                      channelSettings.featuredChannelsTitle =
                                          channelSettingsOptions.featuredChannelsTitle;
                                  }
                                  if (channelSettingsOptions.featuredChannelsUrls) {
                                      channelSettings.featuredChannelsUrls =
                                          channelSettingsOptions.featuredChannelsUrls;
                                  }
                                  if (channelSettingsOptions.keywords) {
                                      channelSettings.keywords = channelSettingsOptions.keywords;
                                  }
                                  if (channelSettingsOptions.moderateComments) {
                                      channelSettings.moderateComments =
                                          channelSettingsOptions.moderateComments;
                                  }
                                  if (channelSettingsOptions.profileColor) {
                                      channelSettings.profileColor = channelSettingsOptions.profileColor;
                                  }
                                  if (channelSettingsOptions.profileColor) {
                                      channelSettings.profileColor = channelSettingsOptions.profileColor;
                                  }
                                  if (channelSettingsOptions.showRelatedChannels) {
                                      channelSettings.showRelatedChannels =
                                          channelSettingsOptions.showRelatedChannels;
                                  }
                                  if (channelSettingsOptions.showBrowseView) {
                                      channelSettings.showBrowseView = channelSettingsOptions.showBrowseView;
                                  }
                                  if (channelSettingsOptions.trackingAnalyticsAccountId) {
                                      channelSettings.trackingAnalyticsAccountId =
                                          channelSettingsOptions.trackingAnalyticsAccountId;
                                  }
                                  if (channelSettingsOptions.unsubscribedTrailer) {
                                      channelSettings.unsubscribedTrailer =
                                          channelSettingsOptions.unsubscribedTrailer;
                                  }
                              }
                              const imageSettingsValues = updateFields.brandingSettingsUi
                                  .imageSettingsValues;
                              const imageSettings = {};
                              if (imageSettingsValues === null || imageSettingsValues === void 0 ? void 0 : imageSettingsValues.image) {
                                  const imageSettingsOptions = imageSettings.image;
                                  if (imageSettingsOptions.bannerExternalUrl) {
                                      imageSettings.bannerExternalUrl =
                                          imageSettingsOptions.bannerExternalUrl;
                                  }
                                  if (imageSettingsOptions.trackingImageUrl) {
                                      imageSettings.trackingImageUrl = imageSettingsOptions.trackingImageUrl;
                                  }
                                  if (imageSettingsOptions.watchIconImageUrl) {
                                      imageSettings.watchIconImageUrl =
                                          imageSettingsOptions.watchIconImageUrl;
                                  }
                              }
                              body.brandingSettings.channel = channelSettings;
                              body.brandingSettings.image = imageSettings;
                          }
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'PUT', '/youtube/v3/channels', body, qs);
                      }
                      if (operation === 'uploadBanner') {
                          const channelId = this.getNodeParameter('channelId', i);
                          const binaryProperty = this.getNodeParameter('binaryProperty', i);
                          const binaryData = this.helpers.assertBinaryData(i, binaryProperty);
                          const body = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
                          const requestOptions = {
                              headers: {
                                  ...(binaryData.mimeType ? { 'Content-Type': binaryData.mimeType } : {}),
                              },
                              json: false,
                          };
                          const response = await GenericFunctions_1.googleApiRequest.call(this, 'POST', '/upload/youtube/v3/channelBanners/insert', body, qs, undefined, requestOptions);
                          const { url } = JSON.parse(response);
                          qs.part = 'brandingSettings';
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'PUT', '/youtube/v3/channels', {
                              id: channelId,
                              brandingSettings: {
                                  image: {
                                      bannerExternalUrl: url,
                                  },
                              },
                          }, qs);
                      }
                  }
                  if (resource === 'playlist') {
                      if (operation === 'get') {
                          let part = this.getNodeParameter('part', i);
                          const playlistId = this.getNodeParameter('playlistId', i);
                          const options = this.getNodeParameter('options', i);
                          if (part.includes('*')) {
                              part = ['contentDetails', 'id', 'localizations', 'player', 'snippet', 'status'];
                          }
                          qs.part = part.join(',');
                          qs.id = playlistId;
                          Object.assign(qs, options);
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/playlists', {}, qs);
                          responseData = responseData.items;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          let part = this.getNodeParameter('part', i);
                          const options = this.getNodeParameter('options', i);
                          const filters = this.getNodeParameter('filters', i);
                          if (part.includes('*')) {
                              part = ['contentDetails', 'id', 'localizations', 'player', 'snippet', 'status'];
                          }
                          qs.part = part.join(',');
                          Object.assign(qs, options, filters);
                          qs.mine = true;
                          if (qs.channelId || qs.id) {
                              delete qs.mine;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'items', 'GET', '/youtube/v3/playlists', {}, qs);
                          }
                          else {
                              qs.maxResults = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/playlists', {}, qs);
                              responseData = responseData.items;
                          }
                      }
                      if (operation === 'create') {
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          qs.part = 'snippet';
                          const body = {
                              snippet: {
                                  title,
                              },
                          };
                          if (options.tags) {
                              body.snippet.tags = options.tags.split(',');
                          }
                          if (options.description) {
                              body.snippet.privacyStatus = options.privacyStatus;
                          }
                          if (options.defaultLanguage) {
                              body.snippet.defaultLanguage = options.defaultLanguage;
                          }
                          if (options.onBehalfOfContentOwner) {
                              qs.onBehalfOfContentOwner = options.onBehalfOfContentOwner;
                          }
                          if (options.onBehalfOfContentOwnerChannel) {
                              qs.onBehalfOfContentOwnerChannel = options.onBehalfOfContentOwnerChannel;
                          }
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'POST', '/youtube/v3/playlists', body, qs);
                      }
                      if (operation === 'update') {
                          const playlistId = this.getNodeParameter('playlistId', i);
                          const title = this.getNodeParameter('title', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          qs.part = 'snippet, status';
                          const body = {
                              id: playlistId,
                              snippet: {
                                  title,
                              },
                              status: {},
                          };
                          if (updateFields.tags) {
                              body.snippet.tags = updateFields.tags.split(',');
                          }
                          if (updateFields.privacyStatus) {
                              body.status.privacyStatus = updateFields.privacyStatus;
                          }
                          if (updateFields.description) {
                              body.snippet.description = updateFields.description;
                          }
                          if (updateFields.defaultLanguage) {
                              body.snippet.defaultLanguage = updateFields.defaultLanguage;
                          }
                          if (updateFields.onBehalfOfContentOwner) {
                              qs.onBehalfOfContentOwner = updateFields.onBehalfOfContentOwner;
                          }
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'PUT', '/youtube/v3/playlists', body, qs);
                      }
                      if (operation === 'delete') {
                          const playlistId = this.getNodeParameter('playlistId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              id: playlistId,
                          };
                          if (options.onBehalfOfContentOwner) {
                              qs.onBehalfOfContentOwner = options.onBehalfOfContentOwner;
                          }
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'DELETE', '/youtube/v3/playlists', body);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'playlistItem') {
                      if (operation === 'get') {
                          let part = this.getNodeParameter('part', i);
                          const playlistItemId = this.getNodeParameter('playlistItemId', i);
                          const options = this.getNodeParameter('options', i);
                          if (part.includes('*')) {
                              part = ['contentDetails', 'id', 'snippet', 'status'];
                          }
                          qs.part = part.join(',');
                          qs.id = playlistItemId;
                          Object.assign(qs, options);
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/playlistItems', {}, qs);
                          responseData = responseData.items;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          let part = this.getNodeParameter('part', i);
                          const options = this.getNodeParameter('options', i);
                          const playlistId = this.getNodeParameter('playlistId', i);
                          if (part.includes('*')) {
                              part = ['contentDetails', 'id', 'snippet', 'status'];
                          }
                          qs.playlistId = playlistId;
                          qs.part = part.join(',');
                          Object.assign(qs, options);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'items', 'GET', '/youtube/v3/playlistItems', {}, qs);
                          }
                          else {
                              qs.maxResults = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/playlistItems', {}, qs);
                              responseData = responseData.items;
                          }
                      }
                      if (operation === 'add') {
                          const playlistId = this.getNodeParameter('playlistId', i);
                          const videoId = this.getNodeParameter('videoId', i);
                          const options = this.getNodeParameter('options', i);
                          qs.part = 'snippet, contentDetails';
                          const body = {
                              snippet: {
                                  playlistId,
                                  resourceId: {
                                      kind: 'youtube#video',
                                      videoId,
                                  },
                              },
                              contentDetails: {},
                          };
                          if (options.position) {
                              body.snippet.position = options.position;
                          }
                          if (options.note) {
                              body.contentDetails.note = options.note;
                          }
                          if (options.startAt) {
                              body.contentDetails.startAt = options.startAt;
                          }
                          if (options.endAt) {
                              body.contentDetails.endAt = options.endAt;
                          }
                          if (options.onBehalfOfContentOwner) {
                              qs.onBehalfOfContentOwner = options.onBehalfOfContentOwner;
                          }
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'POST', '/youtube/v3/playlistItems', body, qs);
                      }
                      if (operation === 'delete') {
                          const playlistItemId = this.getNodeParameter('playlistItemId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              id: playlistItemId,
                          };
                          if (options.onBehalfOfContentOwner) {
                              qs.onBehalfOfContentOwner = options.onBehalfOfContentOwner;
                          }
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'DELETE', '/youtube/v3/playlistItems', body);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'video') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs.part = 'snippet';
                          qs.type = 'video';
                          qs.forMine = true;
                          Object.assign(qs, options, filters);
                          if (Object.keys(filters).length > 0) {
                              delete qs.forMine;
                          }
                          if (qs.relatedToVideoId && qs.forDeveloper !== undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), "When using the parameter 'related to video' the parameter 'for developer' cannot be set", { itemIndex: i });
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.googleApiRequestAllItems.call(this, 'items', 'GET', '/youtube/v3/search', {}, qs);
                          }
                          else {
                              qs.maxResults = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/search', {}, qs);
                              responseData = responseData.items;
                          }
                      }
                      if (operation === 'get') {
                          let part = this.getNodeParameter('part', i);
                          const videoId = this.getNodeParameter('videoId', i);
                          const options = this.getNodeParameter('options', i);
                          if (part.includes('*')) {
                              part = [
                                  'contentDetails',
                                  'id',
                                  'liveStreamingDetails',
                                  'localizations',
                                  'player',
                                  'recordingDetails',
                                  'snippet',
                                  'statistics',
                                  'status',
                                  'topicDetails',
                              ];
                          }
                          qs.part = part.join(',');
                          qs.id = videoId;
                          Object.assign(qs, options);
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/videos', {}, qs);
                          responseData = responseData.items;
                      }
                      if (operation === 'upload') {
                          const title = this.getNodeParameter('title', i);
                          const categoryId = this.getNodeParameter('categoryId', i);
                          const options = this.getNodeParameter('options', i);
                          const binaryProperty = this.getNodeParameter('binaryProperty', i);
                          const binaryData = this.helpers.assertBinaryData(i, binaryProperty);
                          let mimeType;
                          let contentLength;
                          let fileContent;
                          if (binaryData.id) {
                              fileContent = await this.helpers.getBinaryStream(binaryData.id, UPLOAD_CHUNK_SIZE);
                              const metadata = await this.helpers.getBinaryMetadata(binaryData.id);
                              contentLength = metadata.fileSize;
                              mimeType = (_a = metadata.mimeType) !== null && _a !== void 0 ? _a : binaryData.mimeType;
                          }
                          else {
                              fileContent = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
                              contentLength = fileContent.length;
                              mimeType = binaryData.mimeType;
                          }
                          const payload = {
                              snippet: {
                                  title,
                                  categoryId,
                                  description: options.description,
                                  tags: (_b = options.tags) === null || _b === void 0 ? void 0 : _b.split(','),
                                  defaultLanguage: options.defaultLanguage,
                              },
                              status: {
                                  privacyStatus: options.privacyStatus,
                                  embeddable: options.embeddable,
                                  publicStatsViewable: options.publicStatsViewable,
                                  publishAt: options.publishAt,
                                  selfDeclaredMadeForKids: options.selfDeclaredMadeForKids,
                                  license: options.license,
                              },
                              recordingDetails: {
                                  recordingDate: options.recordingDate,
                              },
                          };
                          const resumableUpload = await GenericFunctions_1.googleApiRequest.call(this, 'POST', '/upload/youtube/v3/videos', payload, {
                              uploadType: 'resumable',
                              part: 'snippet,status,recordingDetails',
                              notifySubscribers: (_c = options.notifySubscribers) !== null && _c !== void 0 ? _c : false,
                          }, undefined, {
                              headers: {
                                  'X-Upload-Content-Length': contentLength,
                                  'X-Upload-Content-Type': mimeType,
                              },
                              json: true,
                              resolveWithFullResponse: true,
                          });
                          const uploadUrl = resumableUpload.headers.location;
                          let uploadId;
                          let offset = 0;
                          for await (const chunk of fileContent) {
                              const nextOffset = offset + Number(chunk.length);
                              try {
                                  const response = await this.helpers.httpRequest({
                                      method: 'PUT',
                                      url: uploadUrl,
                                      headers: {
                                          'Content-Length': chunk.length,
                                          'Content-Range': `bytes ${offset}-${nextOffset - 1}/${contentLength}`,
                                      },
                                      body: chunk,
                                  });
                                  uploadId = response.id;
                              }
                              catch (error) {
                                  if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) !== 308)
                                      throw error;
                              }
                              offset = nextOffset;
                          }
                          responseData = { uploadId, ...resumableUpload.body };
                      }
                      if (operation === 'update') {
                          const id = this.getNodeParameter('videoId', i);
                          const title = this.getNodeParameter('title', i);
                          const categoryId = this.getNodeParameter('categoryId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          qs.part = 'snippet, status, recordingDetails';
                          const body = {
                              id,
                              snippet: {
                                  title,
                                  categoryId,
                              },
                              status: {},
                              recordingDetails: {},
                          };
                          if (updateFields.description) {
                              body.snippet.description = updateFields.description;
                          }
                          if (updateFields.privacyStatus) {
                              body.status.privacyStatus = updateFields.privacyStatus;
                          }
                          if (updateFields.tags) {
                              body.snippet.tags = updateFields.tags.split(',');
                          }
                          if (updateFields.embeddable) {
                              body.status.embeddable = updateFields.embeddable;
                          }
                          if (updateFields.publicStatsViewable) {
                              body.status.publicStatsViewable = updateFields.publicStatsViewable;
                          }
                          if (updateFields.publishAt) {
                              body.status.publishAt = updateFields.publishAt;
                          }
                          if (updateFields.selfDeclaredMadeForKids) {
                              body.status.selfDeclaredMadeForKids = updateFields.selfDeclaredMadeForKids;
                          }
                          if (updateFields.recordingDate) {
                              body.recordingDetails.recordingDate = updateFields.recordingDate;
                          }
                          if (updateFields.license) {
                              body.status.license = updateFields.license;
                          }
                          if (updateFields.defaultLanguage) {
                              body.snippet.defaultLanguage = updateFields.defaultLanguage;
                          }
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'PUT', '/youtube/v3/videos', body, qs);
                      }
                      if (operation === 'delete') {
                          const videoId = this.getNodeParameter('videoId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              id: videoId,
                          };
                          if (options.onBehalfOfContentOwner) {
                              qs.onBehalfOfContentOwner = options.onBehalfOfContentOwner;
                          }
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'DELETE', '/youtube/v3/videos', body);
                          responseData = { success: true };
                      }
                      if (operation === 'rate') {
                          const videoId = this.getNodeParameter('videoId', i);
                          const rating = this.getNodeParameter('rating', i);
                          const body = {
                              id: videoId,
                              rating,
                          };
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'POST', '/youtube/v3/videos/rate', body);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'videoCategory') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const regionCode = this.getNodeParameter('regionCode', i);
                          qs.regionCode = regionCode;
                          qs.part = 'snippet';
                          responseData = await GenericFunctions_1.googleApiRequest.call(this, 'GET', '/youtube/v3/videoCategories', {}, qs);
                          responseData = responseData.items;
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                  }
              }
              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.YouTube = YouTube;
  //# sourceMappingURL=YouTube.node.js.map

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

  # YouTube node

  Use the YouTube node to automate work in YouTube, and integrate YouTube with other applications. n8n has built-in support for a wide range of YouTube features, including retrieving and updating channels, as well as creating and deleting playlists. 

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

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

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

  ## Operations

  * Channel
      * Retrieve a channel
      * Retrieve all channels
      * Update a channel
      * Upload a channel banner
  * Playlist
      * Create a playlist
      * Delete a playlist
      * Get a playlist
      * Retrieve all playlists
      * Update a playlist
  * Playlist Item
      * Add an item to a playlist
      * Delete a item from a playlist
      * Get a playlist's item
      * Retrieve all playlist items
  * Video
      * Delete a video
      * Get a video
      * Retrieve all videos
      * Rate a video
      * Update a video
      * Upload a video
  * Video Category
      * Retrieve all video categories

  ## Templates and examples

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

  --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":"89eabe3c-14ff-4bd0-88ef-3b26ab46e3a8","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"d68e738363144213ca858459d6b33cc0acb2d6ae45e64ccbce9b708357027d4e"}}


node_type: n8n-nodes-base.HackerNews
name: HackerNews
display_name: Hacker News
description: Consume Hacker News API
category: transform
icon: file:hackernews.png
code_hash: 390a3ac297411fe2c0fc2a82381c6d6bf1ad8892139f36e09da9b1782c055c0e
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.hackernews
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:01
updated_at: 2025-06-08 09:18:01
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.HackerNews = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  class HackerNews {
      constructor() {
          this.description = {
              displayName: 'Hacker News',
              name: 'hackerNews',
              icon: 'file:hackernews.png',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Hacker News API',
              defaults: {
                  name: 'Hacker News',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'All',
                              value: 'all',
                          },
                          {
                              name: 'Article',
                              value: 'article',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'article',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['all'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many items',
                              action: 'Get many items',
                          },
                      ],
                      default: 'getAll',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['article'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a Hacker News article',
                              action: 'Get an article',
                          },
                      ],
                      default: 'get',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['user'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a Hacker News user',
                              action: 'Get a user',
                          },
                      ],
                      default: 'get',
                  },
                  {
                      displayName: 'Article ID',
                      name: 'articleId',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The ID of the Hacker News article to be returned',
                      displayOptions: {
                          show: {
                              resource: ['article'],
                              operation: ['get'],
                          },
                      },
                  },
                  {
                      displayName: 'Username',
                      name: 'username',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The Hacker News user to be returned',
                      displayOptions: {
                          show: {
                              resource: ['user'],
                              operation: ['get'],
                          },
                      },
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                      displayOptions: {
                          show: {
                              resource: ['all'],
                              operation: ['getAll'],
                          },
                      },
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      default: 100,
                      description: 'Max number of results to return',
                      displayOptions: {
                          show: {
                              resource: ['all'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['article'],
                              operation: ['get'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Include Comments',
                              name: 'includeComments',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to include all the comments in a Hacker News article',
                          },
                      ],
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['all'],
                              operation: ['getAll'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Keyword',
                              name: 'keyword',
                              type: 'string',
                              default: '',
                              description: 'The keyword for filtering the results of the query',
                          },
                          {
                              displayName: 'Tags',
                              name: 'tags',
                              type: 'multiOptions',
                              options: [
                                  {
                                      name: 'Ask HN',
                                      value: 'ask_hn',
                                      description: 'Returns query results filtered by Ask HN tag',
                                  },
                                  {
                                      name: 'Comment',
                                      value: 'comment',
                                      description: 'Returns query results filtered by comment tag',
                                  },
                                  {
                                      name: 'Front Page',
                                      value: 'front_page',
                                      description: 'Returns query results filtered by Front Page tag',
                                  },
                                  {
                                      name: 'Poll',
                                      value: 'poll',
                                      description: 'Returns query results filtered by poll tag',
                                  },
                                  {
                                      name: 'Show HN',
                                      value: 'show_hn',
                                      description: 'Returns query results filtered by Show HN tag',
                                  },
                                  {
                                      name: 'Story',
                                      value: 'story',
                                      description: 'Returns query results filtered by story tag',
                                  },
                              ],
                              default: [],
                              description: 'Tags for filtering the results of the query',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let returnAll = false;
          for (let i = 0; i < items.length; i++) {
              try {
                  let qs = {};
                  let endpoint = '';
                  let includeComments = false;
                  if (resource === 'all') {
                      if (operation === 'getAll') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const keyword = additionalFields.keyword;
                          const tags = additionalFields.tags;
                          qs = {
                              query: keyword,
                              tags: tags ? tags.join() : '',
                          };
                          returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              qs.hitsPerPage = this.getNodeParameter('limit', i);
                          }
                          endpoint = 'search?';
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'article') {
                      if (operation === 'get') {
                          endpoint = `items/${this.getNodeParameter('articleId', i)}`;
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          includeComments = additionalFields.includeComments;
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'get') {
                          endpoint = `users/${this.getNodeParameter('username', i)}`;
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i });
                      }
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource '${resource}' is unknown!`, {
                          itemIndex: i,
                      });
                  }
                  let responseData;
                  if (returnAll) {
                      responseData = await GenericFunctions_1.hackerNewsApiRequestAllItems.call(this, 'GET', endpoint, qs);
                  }
                  else {
                      responseData = await GenericFunctions_1.hackerNewsApiRequest.call(this, 'GET', endpoint, qs);
                      if (resource === 'all' && operation === 'getAll') {
                          responseData = responseData.hits;
                      }
                  }
                  if (resource === 'article' && operation === 'get' && !includeComments) {
                      delete responseData.children;
                  }
                  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.HackerNews = HackerNews;
  //# sourceMappingURL=HackerNews.node.js.map

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

  # Hacker News node

  Use the Hacker News node to automate work in Hacker News, and integrate Hacker News with other applications. n8n has built-in support for a wide range of Hacker News features, including getting articles, and users. 

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

  /// note | Credentials
  This node doesn't require authentication. 
  ///

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

  ## Operations

  * All
      * Get all items
  * Article
      * Get a Hacker News article
  * User
      * Get a Hacker News user

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"063fc24f-076c-4d97-8fbd-4de87787280d","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"f07836f8a1a34edeb2ea50a77ee139b06bf9dd51dcc81910bd215f56286c7318"}}


node_type: n8n-nodes-base.Grist
name: Grist
display_name: Grist
description: Consume the Grist API
category: input
icon: file:grist.svg
code_hash: e8f869266965538c4386d983c696a348cc0a78697e10318e33745fa5cc66ab9a
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.grist
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:01
updated_at: 2025-06-08 09:18:01
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Grist = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const OperationDescription_1 = require("./OperationDescription");
  class Grist {
      constructor() {
          this.description = {
              displayName: 'Grist',
              name: 'grist',
              icon: 'file:grist.svg',
              subtitle: '={{$parameter["operation"]}}',
              group: ['input'],
              version: 1,
              description: 'Consume the Grist API',
              defaults: {
                  name: 'Grist',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'gristApi',
                      required: true,
                      testedBy: 'gristApiTest',
                  },
              ],
              properties: OperationDescription_1.operationFields,
          };
          this.methods = {
              loadOptions: {
                  async getTableColumns() {
                      const docId = this.getNodeParameter('docId', 0);
                      const tableId = this.getNodeParameter('tableId', 0);
                      const endpoint = `/docs/${docId}/tables/${tableId}/columns`;
                      const { columns } = (await GenericFunctions_1.gristApiRequest.call(this, 'GET', endpoint));
                      return columns.map(({ id }) => ({ name: id, value: id }));
                  },
              },
              credentialTest: {
                  async gristApiTest(credential) {
                      const { apiKey, planType, customSubdomain, selfHostedUrl } = credential.data;
                      const endpoint = '/orgs';
                      const gristapiurl = planType === 'free'
                          ? `https://docs.getgrist.com/api${endpoint}`
                          : planType === 'paid'
                              ? `https://${customSubdomain}.getgrist.com/api${endpoint}`
                              : `${selfHostedUrl}/api${endpoint}`;
                      const options = {
                          headers: {
                              Authorization: `Bearer ${apiKey}`,
                          },
                          method: 'GET',
                          uri: gristapiurl,
                          qs: { limit: 1 },
                          json: true,
                      };
                      try {
                          await this.helpers.request(options);
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          let responseData;
          const returnData = [];
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (operation === 'create') {
                      const body = { records: [] };
                      const dataToSend = this.getNodeParameter('dataToSend', 0);
                      if (dataToSend === 'autoMapInputs') {
                          const incomingKeys = Object.keys(items[i].json);
                          const rawInputsToIgnore = this.getNodeParameter('inputsToIgnore', i);
                          const inputsToIgnore = rawInputsToIgnore.split(',').map((c) => c.trim());
                          const fields = (0, GenericFunctions_1.parseAutoMappedInputs)(incomingKeys, inputsToIgnore, items[i].json);
                          body.records.push({ fields });
                      }
                      else if (dataToSend === 'defineInNode') {
                          const { properties } = this.getNodeParameter('fieldsToSend', i, []);
                          GenericFunctions_1.throwOnZeroDefinedFields.call(this, properties);
                          body.records.push({ fields: (0, GenericFunctions_1.parseDefinedFields)(properties) });
                      }
                      const docId = this.getNodeParameter('docId', 0);
                      const tableId = this.getNodeParameter('tableId', 0);
                      const endpoint = `/docs/${docId}/tables/${tableId}/records`;
                      responseData = await GenericFunctions_1.gristApiRequest.call(this, 'POST', endpoint, body);
                      responseData = {
                          id: responseData.records[0].id,
                          ...body.records[0].fields,
                      };
                  }
                  else if (operation === 'delete') {
                      const docId = this.getNodeParameter('docId', 0);
                      const tableId = this.getNodeParameter('tableId', 0);
                      const endpoint = `/docs/${docId}/tables/${tableId}/data/delete`;
                      const rawRowIds = this.getNodeParameter('rowId', i).toString();
                      const body = rawRowIds
                          .split(',')
                          .map((c) => c.trim())
                          .map(Number);
                      await GenericFunctions_1.gristApiRequest.call(this, 'POST', endpoint, body);
                      responseData = { success: true };
                  }
                  else if (operation === 'update') {
                      const body = { records: [] };
                      const rowId = this.getNodeParameter('rowId', i);
                      const dataToSend = this.getNodeParameter('dataToSend', 0);
                      if (dataToSend === 'autoMapInputs') {
                          const incomingKeys = Object.keys(items[i].json);
                          const rawInputsToIgnore = this.getNodeParameter('inputsToIgnore', i);
                          const inputsToIgnore = rawInputsToIgnore.split(',').map((c) => c.trim());
                          const fields = (0, GenericFunctions_1.parseAutoMappedInputs)(incomingKeys, inputsToIgnore, items[i].json);
                          body.records.push({ id: Number(rowId), fields });
                      }
                      else if (dataToSend === 'defineInNode') {
                          const { properties } = this.getNodeParameter('fieldsToSend', i, []);
                          GenericFunctions_1.throwOnZeroDefinedFields.call(this, properties);
                          const fields = (0, GenericFunctions_1.parseDefinedFields)(properties);
                          body.records.push({ id: Number(rowId), fields });
                      }
                      const docId = this.getNodeParameter('docId', 0);
                      const tableId = this.getNodeParameter('tableId', 0);
                      const endpoint = `/docs/${docId}/tables/${tableId}/records`;
                      await GenericFunctions_1.gristApiRequest.call(this, 'PATCH', endpoint, body);
                      responseData = {
                          id: rowId,
                          ...body.records[0].fields,
                      };
                  }
                  else if (operation === 'getAll') {
                      const docId = this.getNodeParameter('docId', 0);
                      const tableId = this.getNodeParameter('tableId', 0);
                      const endpoint = `/docs/${docId}/tables/${tableId}/records`;
                      const qs = {};
                      const returnAll = this.getNodeParameter('returnAll', i);
                      if (!returnAll) {
                          qs.limit = this.getNodeParameter('limit', i);
                      }
                      const { sort, filter } = this.getNodeParameter('additionalOptions', i);
                      if (sort === null || sort === void 0 ? void 0 : sort.sortProperties.length) {
                          qs.sort = (0, GenericFunctions_1.parseSortProperties)(sort.sortProperties);
                      }
                      if (filter === null || filter === void 0 ? void 0 : filter.filterProperties.length) {
                          const parsed = (0, GenericFunctions_1.parseFilterProperties)(filter.filterProperties);
                          qs.filter = JSON.stringify(parsed);
                      }
                      responseData = await GenericFunctions_1.gristApiRequest.call(this, 'GET', endpoint, {}, qs);
                      responseData = responseData.records.map((data) => {
                          return { id: data.id, ...data.fields };
                      });
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionData);
                      continue;
                  }
                  throw error;
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Grist = Grist;
  //# sourceMappingURL=Grist.node.js.map

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

  # Grist node

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

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

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

  ## Operations

  * Create rows in a table
  * Delete rows from a table
  * Read rows from a table
  * Update rows in a table

  ## Templates and examples

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

  ## Get the Row ID

  To update or delete a particular record, you need the Row ID. There are two ways to get the Row ID:

  **Create a Row ID column in Grist**

  Create a new column in your Grist table with the formula `$id`.

  **Use the Get All operation**

  The **Get All** operation returns the Row ID of each record along with the fields.
   
  You can get it with the expression `{{$node["GristNodeName"].json["id"]}}`.


  ## Filter records when using the Get All operation

  - Select **Add Option** and select **Filter** from the dropdown list.
  - You can add filters for any number of columns. The result will only include records which match all the columns.
  - For each column, you can enter any number of values separated by commas. The result will include records which match any of the values for that column.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"854649cc-3687-4e00-b064-9601b02b5e95","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"d1ce21512210778e3dce103baf7680a78d7fbe2b0fb7a046574f61b2058b8eb2"}}


node_type: n8n-nodes-base.HaloPSA
name: HaloPSA
display_name: HaloPSA
description: Consume HaloPSA API
category: input
icon: file:halopsa.svg
code_hash: 348d3698443ef486a9c597678fddb4d72550e7533c4fda90085d98e84585b00a
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.halopsa
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:01
updated_at: 2025-06-08 09:18:01
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.HaloPSA = void 0;
  const descriptions_1 = require("./descriptions");
  const GenericFunctions_1 = require("./GenericFunctions");
  class HaloPSA {
      constructor() {
          this.description = {
              displayName: 'HaloPSA',
              name: 'haloPSA',
              icon: 'file:halopsa.svg',
              group: ['input'],
              version: 1,
              description: 'Consume HaloPSA API',
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              defaults: {
                  name: 'HaloPSA',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'haloPSAApi',
                      required: true,
                      testedBy: 'haloPSAApiCredentialTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Client',
                              value: 'client',
                          },
                          {
                              name: 'Site',
                              value: 'site',
                          },
                          {
                              name: 'Ticket',
                              value: 'ticket',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'client',
                      required: true,
                  },
                  ...descriptions_1.clientOperations,
                  ...descriptions_1.clientFields,
                  ...descriptions_1.ticketOperations,
                  ...descriptions_1.ticketFields,
                  ...descriptions_1.siteOperations,
                  ...descriptions_1.siteFields,
                  ...descriptions_1.userOperations,
                  ...descriptions_1.userFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getHaloPSASites() {
                      const tokens = await GenericFunctions_1.getAccessTokens.call(this);
                      const response = (await GenericFunctions_1.haloPSAApiRequestAllItems.call(this, 'sites', 'GET', '/site', tokens.access_token));
                      const options = response.map((site) => {
                          return {
                              name: site.clientsite_name,
                              value: site.id,
                          };
                      });
                      return options.sort((a, b) => a.name.localeCompare(b.name));
                  },
                  async getHaloPSAClients() {
                      const tokens = await GenericFunctions_1.getAccessTokens.call(this);
                      const response = (await GenericFunctions_1.haloPSAApiRequestAllItems.call(this, 'clients', 'GET', '/Client', tokens.access_token));
                      const options = response.map((client) => {
                          return {
                              name: client.name,
                              value: client.id,
                          };
                      });
                      return options.sort((a, b) => a.name.localeCompare(b.name));
                  },
                  async getHaloPSATicketsTypes() {
                      const tokens = await GenericFunctions_1.getAccessTokens.call(this);
                      const response = (await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', '/TicketType', tokens.access_token, {}));
                      const options = response.map((ticket) => {
                          return {
                              name: ticket.name,
                              value: ticket.id,
                          };
                      });
                      return options
                          .filter((ticket) => {
                          if (ticket.name.includes('Request') ||
                              ticket.name.includes('Offboarding') ||
                              ticket.name.includes('Onboarding') ||
                              ticket.name.includes('Other Hardware') ||
                              ticket.name.includes('Software Change')) {
                              return false;
                          }
                          return true;
                      })
                          .sort((a, b) => a.name.localeCompare(b.name));
                  },
                  async getHaloPSAAgents() {
                      const tokens = await GenericFunctions_1.getAccessTokens.call(this);
                      const response = (await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', '/agent', tokens.access_token, {}));
                      const options = response.map((agent) => {
                          return {
                              name: agent.name,
                              value: agent.id,
                          };
                      });
                      return options.sort((a, b) => a.name.localeCompare(b.name));
                  },
              },
              credentialTest: {
                  async haloPSAApiCredentialTest(credential) {
                      try {
                          await GenericFunctions_1.validateCredentials.call(this, credential.data);
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const tokens = await GenericFunctions_1.getAccessTokens.call(this);
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'client') {
                      const simplifiedOutput = ['id', 'name', 'notes', 'is_vip', 'website'];
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const name = this.getNodeParameter('clientName', i);
                          const body = {
                              name,
                              ...additionalFields,
                          };
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'POST', '/client', tokens.access_token, [body]);
                      }
                      if (operation === 'delete') {
                          const clientId = this.getNodeParameter('clientId', i);
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'DELETE', `/client/${clientId}`, tokens.access_token);
                      }
                      if (operation === 'get') {
                          const clientId = this.getNodeParameter('clientId', i);
                          const simplify = this.getNodeParameter('simplify', i);
                          const response = await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', `/client/${clientId}`, tokens.access_token);
                          responseData = simplify
                              ? (0, GenericFunctions_1.simplifyHaloPSAGetOutput)([response], simplifiedOutput)
                              : response;
                      }
                      if (operation === 'getAll') {
                          const filters = this.getNodeParameter('filters', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const simplify = this.getNodeParameter('simplify', i);
                          const qs = {};
                          let response;
                          Object.assign(qs, filters, (0, GenericFunctions_1.qsSetStatus)(filters.activeStatus));
                          if (returnAll) {
                              response = await GenericFunctions_1.haloPSAApiRequestAllItems.call(this, 'clients', 'GET', '/client', tokens.access_token, {}, qs);
                          }
                          else {
                              const limit = this.getNodeParameter('limit', i);
                              qs.count = limit;
                              const { clients } = await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', '/client', tokens.access_token, {}, qs);
                              response = clients;
                          }
                          responseData = simplify
                              ? (0, GenericFunctions_1.simplifyHaloPSAGetOutput)(response, simplifiedOutput)
                              : response;
                      }
                      if (operation === 'update') {
                          const clientId = this.getNodeParameter('clientId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {
                              id: clientId,
                              ...updateFields,
                          };
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'POST', '/client', tokens.access_token, [body]);
                      }
                  }
                  if (resource === 'site') {
                      const simplifiedOutput = [
                          'id',
                          'name',
                          'client_id',
                          'maincontact_name',
                          'notes',
                          'phonenumber',
                      ];
                      if (operation === 'create') {
                          const name = this.getNodeParameter('siteName', i);
                          const clientId = this.getNodeParameter('clientId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              name,
                              client_id: clientId,
                              ...additionalFields,
                          };
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'POST', '/site', tokens.access_token, [body]);
                      }
                      if (operation === 'delete') {
                          const siteId = this.getNodeParameter('siteId', i);
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'DELETE', `/site/${siteId}`, tokens.access_token);
                      }
                      if (operation === 'get') {
                          const siteId = this.getNodeParameter('siteId', i);
                          const simplify = this.getNodeParameter('simplify', i);
                          const response = await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', `/site/${siteId}`, tokens.access_token);
                          responseData = simplify
                              ? (0, GenericFunctions_1.simplifyHaloPSAGetOutput)([response], simplifiedOutput)
                              : response;
                      }
                      if (operation === 'getAll') {
                          const filters = this.getNodeParameter('filters', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const simplify = this.getNodeParameter('simplify', i);
                          const qs = {};
                          let response;
                          Object.assign(qs, filters, (0, GenericFunctions_1.qsSetStatus)(filters.activeStatus));
                          if (returnAll) {
                              response = await GenericFunctions_1.haloPSAApiRequestAllItems.call(this, 'sites', 'GET', '/site', tokens.access_token, {}, qs);
                          }
                          else {
                              const limit = this.getNodeParameter('limit', i);
                              qs.count = limit;
                              const { sites } = await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', '/site', tokens.access_token, {}, qs);
                              response = sites;
                          }
                          responseData = simplify
                              ? (0, GenericFunctions_1.simplifyHaloPSAGetOutput)(response, simplifiedOutput)
                              : response;
                      }
                      if (operation === 'update') {
                          const siteId = this.getNodeParameter('siteId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {
                              id: siteId,
                              ...updateFields,
                          };
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'POST', '/site', tokens.access_token, [body]);
                      }
                  }
                  if (resource === 'ticket') {
                      const simplifiedOutput = [
                          'id',
                          'summary',
                          'details',
                          'agent_id',
                          'startdate',
                          'targetdate',
                      ];
                      if (operation === 'create') {
                          const summary = this.getNodeParameter('summary', i);
                          const details = this.getNodeParameter('details', i);
                          const ticketType = this.getNodeParameter('ticketType', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              tickettype_id: ticketType,
                              summary,
                              details,
                              ...additionalFields,
                          };
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'POST', '/tickets', tokens.access_token, [body]);
                      }
                      if (operation === 'delete') {
                          const ticketId = this.getNodeParameter('ticketId', i);
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'DELETE', `/tickets/${ticketId}`, tokens.access_token);
                      }
                      if (operation === 'get') {
                          const ticketId = this.getNodeParameter('ticketId', i);
                          const simplify = this.getNodeParameter('simplify', i);
                          const response = await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', `/tickets/${ticketId}`, tokens.access_token);
                          responseData = simplify
                              ? (0, GenericFunctions_1.simplifyHaloPSAGetOutput)([response], simplifiedOutput)
                              : response;
                      }
                      if (operation === 'getAll') {
                          const filters = this.getNodeParameter('filters', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const simplify = this.getNodeParameter('simplify', i);
                          const qs = {};
                          let response;
                          Object.assign(qs, filters, (0, GenericFunctions_1.qsSetStatus)(filters.activeStatus));
                          if (returnAll) {
                              response = await GenericFunctions_1.haloPSAApiRequestAllItems.call(this, 'tickets', 'GET', '/tickets', tokens.access_token, {}, qs);
                          }
                          else {
                              const limit = this.getNodeParameter('limit', i);
                              qs.count = limit;
                              const { tickets } = await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', '/tickets', tokens.access_token, {}, qs);
                              response = tickets;
                          }
                          responseData = simplify
                              ? (0, GenericFunctions_1.simplifyHaloPSAGetOutput)(response, simplifiedOutput)
                              : response;
                      }
                      if (operation === 'update') {
                          const ticketId = this.getNodeParameter('ticketId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {
                              id: ticketId,
                              ...updateFields,
                          };
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'POST', '/tickets', tokens.access_token, [body]);
                      }
                  }
                  if (resource === 'user') {
                      const simplifiedOutput = [
                          'id',
                          'name',
                          'site_id',
                          'emailaddress',
                          'notes',
                          'surname',
                          'inactive',
                      ];
                      if (operation === 'create') {
                          const name = this.getNodeParameter('userName', i);
                          const siteId = this.getNodeParameter('siteId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              name,
                              site_id: siteId,
                              ...additionalFields,
                          };
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'POST', '/users', tokens.access_token, [body]);
                      }
                      if (operation === 'delete') {
                          const userId = this.getNodeParameter('userId', i);
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'DELETE', `/users/${userId}`, tokens.access_token);
                      }
                      if (operation === 'get') {
                          const userId = this.getNodeParameter('userId', i);
                          const simplify = this.getNodeParameter('simplify', i);
                          const response = await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', `/users/${userId}`, tokens.access_token);
                          responseData = simplify
                              ? (0, GenericFunctions_1.simplifyHaloPSAGetOutput)([response], simplifiedOutput)
                              : response;
                      }
                      if (operation === 'getAll') {
                          const filters = this.getNodeParameter('filters', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const simplify = this.getNodeParameter('simplify', i);
                          const qs = {};
                          let response;
                          Object.assign(qs, filters, (0, GenericFunctions_1.qsSetStatus)(filters.activeStatus));
                          if (returnAll) {
                              response = await GenericFunctions_1.haloPSAApiRequestAllItems.call(this, 'users', 'GET', '/users', tokens.access_token, {}, qs);
                          }
                          else {
                              const limit = this.getNodeParameter('limit', i);
                              qs.count = limit;
                              const { users } = await GenericFunctions_1.haloPSAApiRequest.call(this, 'GET', '/users', tokens.access_token, {}, qs);
                              response = users;
                          }
                          responseData = simplify
                              ? (0, GenericFunctions_1.simplifyHaloPSAGetOutput)(response, simplifiedOutput)
                              : response;
                      }
                      if (operation === 'update') {
                          const userId = this.getNodeParameter('userId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {
                              id: userId,
                              ...updateFields,
                          };
                          responseData = await GenericFunctions_1.haloPSAApiRequest.call(this, 'POST', '/users', tokens.access_token, [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.HaloPSA = HaloPSA;
  //# sourceMappingURL=HaloPSA.node.js.map

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

  # HaloPSA node

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

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

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

  ## Operations

  * Client
      * Create a client
      * Delete a client
      * Get a client
      * Get all clients
      * Update a client
  * Site
      * Create a site
      * Delete a site
      * Get a site
      * Get all sites
      * Update a site
  * Ticket
      * Create a ticket
      * Delete a ticket
      * Get a ticket
      * Get all tickets
      * Update a ticket
  * User
      * Create a user
      * Delete a user
      * Get a user
      * Get 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, 'halopsa') ]]

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"beadee4f-d7dc-4b05-aba8-54fddd426f17","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"833174f5cc7f4d7fe71d5a5f0de800c1ad68a379ee8e1b9b40ace0d5b500bd38"}}


node_type: n8n-nodes-base.Harvest
name: Harvest
display_name: Harvest
description: Access data on Harvest
category: input
icon: file:harvest.png
code_hash: 9d20cceef719cdf7c26383c042364997d2be9dcd6083b1a6658b0fbc74462275
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.harvest
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:01
updated_at: 2025-06-08 09:18:01
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Harvest = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const ClientDescription_1 = require("./ClientDescription");
  const ContactDescription_1 = require("./ContactDescription");
  const CompanyDescription_1 = require("./CompanyDescription");
  const EstimateDescription_1 = require("./EstimateDescription");
  const ExpenseDescription_1 = require("./ExpenseDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const InvoiceDescription_1 = require("./InvoiceDescription");
  const ProjectDescription_1 = require("./ProjectDescription");
  const TaskDescription_1 = require("./TaskDescription");
  const TimeEntryDescription_1 = require("./TimeEntryDescription");
  const UserDescription_1 = require("./UserDescription");
  class Harvest {
      constructor() {
          this.description = {
              displayName: 'Harvest',
              name: 'harvest',
              icon: 'file:harvest.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Access data on Harvest',
              defaults: {
                  name: 'Harvest',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'harvestApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['accessToken'],
                          },
                      },
                  },
                  {
                      name: 'harvestOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Access Token',
                              value: 'accessToken',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'accessToken',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Client',
                              value: 'client',
                          },
                          {
                              name: 'Company',
                              value: 'company',
                          },
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                          {
                              name: 'Estimate',
                              value: 'estimate',
                          },
                          {
                              name: 'Expense',
                              value: 'expense',
                          },
                          {
                              name: 'Invoice',
                              value: 'invoice',
                          },
                          {
                              name: 'Project',
                              value: 'project',
                          },
                          {
                              name: 'Task',
                              value: 'task',
                          },
                          {
                              name: 'Time Entry',
                              value: 'timeEntry',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'task',
                  },
                  ...ClientDescription_1.clientOperations,
                  ...CompanyDescription_1.companyOperations,
                  ...ContactDescription_1.contactOperations,
                  ...EstimateDescription_1.estimateOperations,
                  ...ExpenseDescription_1.expenseOperations,
                  ...InvoiceDescription_1.invoiceOperations,
                  ...ProjectDescription_1.projectOperations,
                  ...TaskDescription_1.taskOperations,
                  ...TimeEntryDescription_1.timeEntryOperations,
                  ...UserDescription_1.userOperations,
                  {
                      displayName: 'Account Name or ID',
                      name: 'accountId',
                      type: 'options',
                      description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                      required: true,
                      typeOptions: {
                          loadOptionsMethod: 'getAccounts',
                      },
                      default: '',
                  },
                  ...ClientDescription_1.clientFields,
                  ...ContactDescription_1.contactFields,
                  ...EstimateDescription_1.estimateFields,
                  ...ExpenseDescription_1.expenseFields,
                  ...InvoiceDescription_1.invoiceFields,
                  ...ProjectDescription_1.projectFields,
                  ...TaskDescription_1.taskFields,
                  ...TimeEntryDescription_1.timeEntryFields,
                  ...UserDescription_1.userFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getAccounts() {
                      const returnData = [];
                      const { accounts } = await GenericFunctions_1.harvestApiRequest.call(this, 'GET', {}, '', {}, {}, 'https://id.getharvest.com/api/v2/accounts');
                      for (const account of accounts) {
                          const accountName = account.name;
                          const accountId = account.id;
                          returnData.push({
                              name: accountName,
                              value: accountId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let endpoint = '';
          let requestMethod = '';
          let body;
          let qs;
          for (let i = 0; i < items.length; i++) {
              try {
                  body = {};
                  qs = {};
                  if (resource === 'timeEntry') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `time_entries/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'time_entries', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'createByStartEnd') {
                          requestMethod = 'POST';
                          endpoint = 'time_entries';
                          body.project_id = this.getNodeParameter('projectId', i);
                          body.task_id = this.getNodeParameter('taskId', i);
                          body.spent_date = this.getNodeParameter('spentDate', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'createByDuration') {
                          requestMethod = 'POST';
                          endpoint = 'time_entries';
                          body.project_id = this.getNodeParameter('projectId', i);
                          body.task_id = this.getNodeParameter('taskId', i);
                          body.spent_date = this.getNodeParameter('spentDate', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `time_entries/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'deleteExternal') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `time_entries/${id}/external_reference`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'restartTime') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `time_entries/${id}/restart`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'stopTime') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `time_entries/${id}/stop`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `time_entries/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(body, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'client') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `clients/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'clients', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          endpoint = 'clients';
                          body.name = this.getNodeParameter('name', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `clients/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(qs, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `clients/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'project') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `projects/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'projects', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          endpoint = 'projects';
                          body.client_id = this.getNodeParameter('clientId', i);
                          body.name = this.getNodeParameter('name', i);
                          body.is_billable = this.getNodeParameter('isBillable', i);
                          body.bill_by = this.getNodeParameter('billBy', i);
                          body.budget_by = this.getNodeParameter('budgetBy', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `projects/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(body, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `projects/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `users/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'users', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'me') {
                          requestMethod = 'GET';
                          endpoint = 'users/me';
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          endpoint = 'users';
                          body.first_name = this.getNodeParameter('firstName', i);
                          body.last_name = this.getNodeParameter('lastName', i);
                          body.email = this.getNodeParameter('email', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `users/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(qs, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `users/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'contact') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `contacts/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'contacts', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          endpoint = 'contacts';
                          body.client_id = this.getNodeParameter('clientId', i);
                          body.first_name = this.getNodeParameter('firstName', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `contacts/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(qs, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `contacts/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'company') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          endpoint = 'company';
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'task') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `tasks/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'tasks', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          endpoint = 'tasks';
                          body.name = this.getNodeParameter('name', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `tasks/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(qs, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `tasks/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'invoice') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `invoices/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'invoices', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          endpoint = 'invoices';
                          body.client_id = this.getNodeParameter('clientId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `invoices/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(qs, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `invoices/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'expense') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `expenses/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'expenses', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          endpoint = 'expenses';
                          body.project_id = this.getNodeParameter('projectId', i);
                          body.expense_category_id = this.getNodeParameter('expenseCategoryId', i);
                          body.spent_date = this.getNodeParameter('spentDate', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `expenses/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(qs, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `expenses/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else if (resource === 'estimate') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `estimates/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.getAllResource.call(this, 'estimates', i);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          endpoint = 'estimates';
                          body.client_id = this.getNodeParameter('clientId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `estimates/${id}`;
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(qs, updateFields);
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('id', i);
                          endpoint = `estimates/${id}`;
                          const responseData = await GenericFunctions_1.harvestApiRequest.call(this, requestMethod, qs, endpoint);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
                      }
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
                          itemIndex: i,
                      });
                  }
              }
              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.Harvest = Harvest;
  //# sourceMappingURL=Harvest.node.js.map

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

  # Harvest node

  Use the Harvest node to automate work in Harvest, and integrate Harvest with other applications. n8n has built-in support for a wide range of Harvest features, including creating, updating, deleting, and getting clients, contacts, invoices, tasks, expenses, users, and projects. 

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

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

  ## Operations

  * Client
      * Create a client
      * Delete a client
      * Get data of a client
      * Get data of all clients
      * Update a client
  * Company
      * Retrieves the company for the currently authenticated user
  * Contact
      * Create a contact
      * Delete a contact
      * Get data of a contact
      * Get data of all contacts
      * Update a contact
  * Estimate
      * Create an estimate
      * Delete an estimate
      * Get data of an estimate
      * Get data of all estimates
      * Update an estimate
  * Expense
      * Get data of an expense
      * Get data of all expenses
      * Create an expense
      * Update an expense
      * Delete an expense
  * Invoice
      * Get data of an invoice
      * Get data of all invoices
      * Create an invoice
      * Update an invoice
      * Delete an invoice
  * Project
      * Create a project
      * Delete a project
      * Get data of a project
      * Get data of all projects
      * Update a project
  * Task
      * Create a task
      * Delete a task
      * Get data of a task
      * Get data of all tasks
      * Update a task
  * Time Entries
      * Create a time entry using duration
      * Create a time entry using start and end time
      * Delete a time entry
      * Delete a time entry's external reference.
      * Get data of a time entry
      * Get data of all time entries
      * Restart a time entry
      * Stop a time entry
      * Update a time entry
  * User
      * Create a user
      * Delete a user
      * Get data of a user
      * Get data of all users
      * Get data of authenticated user
      * Update a user

  ## Templates and examples

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

  --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":"fc9ac6f1-8b38-4a81-956d-52d451073028","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"4e3b50716813fb70a3de9759276bcbd28f6d83c314a58f9964f08d0de9b5eccb"}}


node_type: n8n-nodes-base.HighLevel
name: HighLevel
display_name: Resource
description: Consume HighLevel API
category: transform
icon: file:highLevel.svg
code_hash: 325f12d22df387974941ce8e51c7dc1941ad49317ca47cd4916fde393a1635d0
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.highlevel
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:01
updated_at: 2025-06-08 09:18:01
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.HighLevel = void 0;
  const ContactDescription_1 = require("./description/ContactDescription");
  const OpportunityDescription_1 = require("./description/OpportunityDescription");
  const TaskDescription_1 = require("./description/TaskDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const ressources = [
      {
          displayName: 'Resource',
          name: 'resource',
          type: 'options',
          noDataExpression: true,
          options: [
              {
                  name: 'Contact',
                  value: 'contact',
              },
              {
                  name: 'Opportunity',
                  value: 'opportunity',
              },
              {
                  name: 'Task',
                  value: 'task',
              },
          ],
          default: 'contact',
          required: true,
      },
  ];
  class HighLevel {
      constructor() {
          this.description = {
              displayName: 'HighLevel',
              name: 'highLevel',
              icon: 'file:highLevel.svg',
              group: ['transform'],
              version: 1,
              description: 'Consume HighLevel API',
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              defaults: {
                  name: 'HighLevel',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'highLevelApi',
                      required: true,
                  },
              ],
              requestDefaults: {
                  baseURL: 'https://rest.gohighlevel.com/v1',
                  headers: {
                      Accept: 'application/json',
                      'Content-Type': 'application/json',
                  },
              },
              requestOperations: {
                  pagination: GenericFunctions_1.highLevelApiPagination,
              },
              properties: [
                  ...ressources,
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactNotes,
                  ...ContactDescription_1.contactFields,
                  ...OpportunityDescription_1.opportunityOperations,
                  ...OpportunityDescription_1.opportunityFields,
                  ...TaskDescription_1.taskOperations,
                  ...TaskDescription_1.taskFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  getPipelineStages: GenericFunctions_1.getPipelineStages,
                  getUsers: GenericFunctions_1.getUsers,
                  getTimezones: GenericFunctions_1.getTimezones,
              },
          };
      }
  }
  exports.HighLevel = HighLevel;
  //# sourceMappingURL=HighLevel.node.js.map

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

  # HighLevel node

  Use the HighLevel node to automate work in HighLevel, and integrate HighLevel with other applications. n8n has built-in support for a wide range of HighLevel features, including creating, updating, deleting, and getting contacts, opportunities, and tasks, as well as booking appointments and getting free time slots in calendars. 

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

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

  ## Operations

  * Contact
  	* Create or update
  	* Delete
  	* Get
  	* Get many
  	* Update
  * Opportunity
  	* Create
  	* Delete
  	* Get
  	* Get many
  	* Update
  * Task
  	* Create
  	* Delete
  	* Get
  	* Get many
  	* Update
  * Calendar
  	* Book an appointment
  	* Get free slots

  ## Templates and examples

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

  ## Related resources

  Refer to [HighLevel's API documentation and support forums](https://help.gohighlevel.com/support/solutions/articles/48001060529-highlevel-api){: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":"3f45bdcb-2291-4053-9e4f-00276a488b16","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"7061a4440c55d0e413f9858ecedc2f7711052b33c7912555e173f20326a5f9fa"}}


node_type: n8n-nodes-base.GraphQL
name: GraphQL
display_name: GraphQL
description: Makes a GraphQL request and returns the received data
category: input
icon: file:graphql.png
code_hash: f9b7d2d27319e62247e107607877b0a9dd51497c47e8eca06c74ba2bd1e36054
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.graphql
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:01
updated_at: 2025-06-08 09:18:01
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.GraphQL = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  class GraphQL {
      constructor() {
          this.description = {
              displayName: 'GraphQL',
              name: 'graphql',
              icon: 'file:graphql.png',
              group: ['input'],
              version: 1,
              description: 'Makes a GraphQL request and returns the received data',
              defaults: {
                  name: 'GraphQL',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'httpBasicAuth',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['basicAuth'],
                          },
                      },
                  },
                  {
                      name: 'httpCustomAuth',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['customAuth'],
                          },
                      },
                  },
                  {
                      name: 'httpDigestAuth',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['digestAuth'],
                          },
                      },
                  },
                  {
                      name: 'httpHeaderAuth',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['headerAuth'],
                          },
                      },
                  },
                  {
                      name: 'httpQueryAuth',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['queryAuth'],
                          },
                      },
                  },
                  {
                      name: 'oAuth1Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth1'],
                          },
                      },
                  },
                  {
                      name: 'oAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Basic Auth',
                              value: 'basicAuth',
                          },
                          {
                              name: 'Custom Auth',
                              value: 'customAuth',
                          },
                          {
                              name: 'Digest Auth',
                              value: 'digestAuth',
                          },
                          {
                              name: 'Header Auth',
                              value: 'headerAuth',
                          },
                          {
                              name: 'None',
                              value: 'none',
                          },
                          {
                              name: 'OAuth1',
                              value: 'oAuth1',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                          {
                              name: 'Query Auth',
                              value: 'queryAuth',
                          },
                      ],
                      default: 'none',
                      description: 'The way to authenticate',
                  },
                  {
                      displayName: 'HTTP Request Method',
                      name: 'requestMethod',
                      type: 'options',
                      options: [
                          {
                              name: 'GET',
                              value: 'GET',
                          },
                          {
                              name: 'POST',
                              value: 'POST',
                          },
                      ],
                      default: 'POST',
                      description: 'The underlying HTTP request method to use',
                  },
                  {
                      displayName: 'Endpoint',
                      name: 'endpoint',
                      type: 'string',
                      default: '',
                      placeholder: 'http://example.com/graphql',
                      description: 'The GraphQL endpoint',
                      required: true,
                  },
                  {
                      displayName: 'Ignore SSL Issues',
                      name: 'allowUnauthorizedCerts',
                      type: 'boolean',
                      default: false,
                      description: 'Whether to download the response even if SSL certificate validation is not possible',
                  },
                  {
                      displayName: 'Request Format',
                      name: 'requestFormat',
                      type: 'options',
                      required: true,
                      options: [
                          {
                              name: 'GraphQL (Raw)',
                              value: 'graphql',
                          },
                          {
                              name: 'JSON',
                              value: 'json',
                          },
                      ],
                      displayOptions: {
                          show: {
                              requestMethod: ['POST'],
                          },
                      },
                      default: 'graphql',
                      description: 'The format for the query payload',
                  },
                  {
                      displayName: 'Query',
                      name: 'query',
                      type: 'json',
                      default: '',
                      description: 'GraphQL query',
                      required: true,
                  },
                  {
                      displayName: 'Variables',
                      name: 'variables',
                      type: 'json',
                      default: '',
                      description: 'Query variables',
                      displayOptions: {
                          show: {
                              requestFormat: ['json'],
                              requestMethod: ['POST'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation Name',
                      name: 'operationName',
                      type: 'string',
                      default: '',
                      description: 'Name of operation to execute',
                      displayOptions: {
                          show: {
                              requestFormat: ['json'],
                              requestMethod: ['POST'],
                          },
                      },
                  },
                  {
                      displayName: 'Response Format',
                      name: 'responseFormat',
                      type: 'options',
                      options: [
                          {
                              name: 'JSON',
                              value: 'json',
                          },
                          {
                              name: 'String',
                              value: 'string',
                          },
                      ],
                      default: 'json',
                      description: 'The format in which the data gets returned from the URL',
                  },
                  {
                      displayName: 'Response Data Property Name',
                      name: 'dataPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              responseFormat: ['string'],
                          },
                      },
                      description: 'Name of the property to which to write the response data',
                  },
                  {
                      displayName: 'Headers',
                      name: 'headerParametersUi',
                      placeholder: 'Add Header',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                      },
                      description: 'The headers to send',
                      default: {},
                      options: [
                          {
                              name: 'parameter',
                              displayName: 'Header',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                      description: 'Name of the header',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                      description: 'Value to set for the header',
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          var _a;
          const items = this.getInputData();
          let httpBasicAuth;
          let httpDigestAuth;
          let httpCustomAuth;
          let httpHeaderAuth;
          let httpQueryAuth;
          let oAuth1Api;
          let oAuth2Api;
          try {
              httpBasicAuth = await this.getCredentials('httpBasicAuth');
          }
          catch (error) {
          }
          try {
              httpCustomAuth = await this.getCredentials('httpCustomAuth');
          }
          catch (error) {
          }
          try {
              httpDigestAuth = await this.getCredentials('httpDigestAuth');
          }
          catch (error) {
          }
          try {
              httpHeaderAuth = await this.getCredentials('httpHeaderAuth');
          }
          catch (error) {
          }
          try {
              httpQueryAuth = await this.getCredentials('httpQueryAuth');
          }
          catch (error) {
          }
          try {
              oAuth1Api = await this.getCredentials('oAuth1Api');
          }
          catch (error) {
          }
          try {
              oAuth2Api = await this.getCredentials('oAuth2Api');
          }
          catch (error) {
          }
          let requestOptions;
          const returnItems = [];
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              try {
                  const requestMethod = this.getNodeParameter('requestMethod', itemIndex, 'POST');
                  const endpoint = this.getNodeParameter('endpoint', itemIndex, '');
                  const requestFormat = this.getNodeParameter('requestFormat', itemIndex, 'graphql');
                  const responseFormat = this.getNodeParameter('responseFormat', 0);
                  const { parameter } = this.getNodeParameter('headerParametersUi', itemIndex, {});
                  const headerParameters = (parameter || []).reduce((result, item) => ({
                      ...result,
                      [item.name]: item.value,
                  }), {});
                  requestOptions = {
                      headers: {
                          'content-type': `application/${requestFormat}`,
                          ...headerParameters,
                      },
                      method: requestMethod,
                      uri: endpoint,
                      simple: false,
                      rejectUnauthorized: !this.getNodeParameter('allowUnauthorizedCerts', itemIndex, false),
                  };
                  if (httpBasicAuth !== undefined) {
                      requestOptions.auth = {
                          user: httpBasicAuth.user,
                          pass: httpBasicAuth.password,
                      };
                  }
                  if (httpCustomAuth !== undefined) {
                      const customAuth = (0, n8n_workflow_1.jsonParse)(httpCustomAuth.json || '{}', { errorMessage: 'Invalid Custom Auth JSON' });
                      if (customAuth.headers) {
                          requestOptions.headers = { ...requestOptions.headers, ...customAuth.headers };
                      }
                      if (customAuth.body) {
                          requestOptions.body = { ...requestOptions.body, ...customAuth.body };
                      }
                      if (customAuth.qs) {
                          requestOptions.qs = { ...requestOptions.qs, ...customAuth.qs };
                      }
                  }
                  if (httpHeaderAuth !== undefined) {
                      requestOptions.headers[httpHeaderAuth.name] = httpHeaderAuth.value;
                  }
                  if (httpQueryAuth !== undefined) {
                      if (!requestOptions.qs) {
                          requestOptions.qs = {};
                      }
                      requestOptions.qs[httpQueryAuth.name] = httpQueryAuth.value;
                  }
                  if (httpDigestAuth !== undefined) {
                      requestOptions.auth = {
                          user: httpDigestAuth.user,
                          pass: httpDigestAuth.password,
                          sendImmediately: false,
                      };
                  }
                  const gqlQuery = this.getNodeParameter('query', itemIndex, '');
                  if (requestMethod === 'GET') {
                      if (!requestOptions.qs) {
                          requestOptions.qs = {};
                      }
                      requestOptions.qs.query = gqlQuery;
                  }
                  else {
                      if (requestFormat === 'json') {
                          requestOptions.body = {
                              ...requestOptions.body,
                              query: gqlQuery,
                              variables: this.getNodeParameter('variables', itemIndex, {}),
                              operationName: this.getNodeParameter('operationName', itemIndex),
                          };
                          if (typeof requestOptions.body.variables === 'string') {
                              try {
                                  requestOptions.body.variables = JSON.parse(requestOptions.body.variables || '{}');
                              }
                              catch (error) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Using variables failed:\n' +
                                      requestOptions.body.variables +
                                      '\n\nWith error message:\n' +
                                      error, { itemIndex });
                              }
                          }
                          if (requestOptions.body.operationName === '') {
                              requestOptions.body.operationName = null;
                          }
                          requestOptions.json = true;
                      }
                      else {
                          requestOptions.body = gqlQuery;
                      }
                  }
                  let response;
                  if (oAuth1Api !== undefined) {
                      response = await this.helpers.requestOAuth1.call(this, 'oAuth1Api', requestOptions);
                  }
                  else if (oAuth2Api !== undefined) {
                      response = await this.helpers.requestOAuth2.call(this, 'oAuth2Api', requestOptions, {
                          tokenType: 'Bearer',
                      });
                  }
                  else {
                      response = await this.helpers.request(requestOptions);
                  }
                  if (responseFormat === 'string') {
                      const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
                      returnItems.push({
                          json: {
                              [dataPropertyName]: response,
                          },
                      });
                  }
                  else {
                      if (typeof response === 'string') {
                          try {
                              response = JSON.parse(response);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"', { itemIndex });
                          }
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), { itemData: { item: itemIndex } });
                      returnItems.push(...executionData);
                  }
                  if (typeof response === 'string' && response.startsWith('{"errors":')) {
                      try {
                          const errorResponse = JSON.parse(response);
                          if (Array.isArray(errorResponse.errors)) {
                              response = errorResponse;
                          }
                      }
                      catch (e) { }
                  }
                  if (typeof response === 'object' && response.errors) {
                      const message = ((_a = response.errors) === null || _a === void 0 ? void 0 : _a.map((error) => error.message).join(', ')) ||
                          'Unexpected error';
                      throw new n8n_workflow_1.NodeApiError(this.getNode(), response.errors, { message });
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const errorData = this.helpers.returnJsonArray({
                          $error: error,
                          json: this.getInputData(itemIndex),
                          itemIndex,
                      });
                      const exectionErrorWithMetaData = this.helpers.constructExecutionMetaData(errorData, {
                          itemData: { item: itemIndex },
                      });
                      returnItems.push(...exectionErrorWithMetaData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnItems];
      }
  }
  exports.GraphQL = GraphQL;
  //# sourceMappingURL=GraphQL.node.js.map

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

  # GraphQL

  [GraphQL](https://graphql.org/){:target=_blank .external-link} is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. Use the GraphQL node to query a GraphQL endpoint.

  ## Node parameters

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

  ### Authentication

  Select the type of authentication to use.

  If you select anything other than **None**, the **Credential for <selected-auth-type>** parameter appears for you to select an existing or create a new authentication credential for that authentication type.

  ### HTTP Request Method

  Select the underlying HTTP Request method the node should use. Choose from:

  * **GET**
  * **POST**: If you select this method, you'll also need to select the **Request Format** the node should use for the query payload. Choose from:
      * **GraphQL (Raw)**
      * **JSON**

  ### Endpoint

  Enter the GraphQL Endpoint you'd like to hit.

  ### Ignore SSL Issues

  When you turn on this control, n8n ignores SSL certificate validation failure.

  ### Query

  Enter the GraphQL query you want to execute.

  Refer to [Related Resources](#related-resources) for information on writing your query.

  ### Response Format

  Select the format you'd like to receive query results in. Choose between:

  * **JSON**
  * **String**: If you select this format, enter a **Response Data Property Name** to define the property the string is written to.

  ## Headers

  Enter any **Headers** you want to pass as part of the query as **Name** / **Value** pairs.

  ## Templates and examples

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

  ## Related resources

  To use the GraphQL node, you need to understand GraphQL query language. GraphQL have their own [Introduction to GraphQL](https://graphql.org/learn/){:target=_blank .external-link} tutorial.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"ff6a755d-ef85-4e97-9a10-78ce991e4395","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"2b6a5229730b962d73341734a20bf7c9327926b35f13bff0e642f1b5ceded8aa"}}


node_type: n8n-nodes-base.HelpScout
name: HelpScout
display_name: HelpScout
description: Consume HelpScout API
category: input
icon: file:helpScout.svg
code_hash: ed850f3e789d21697c107e859b43364714ce661c3158cea1742fa42285f570d5
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.helpscouttrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:01
updated_at: 2025-06-08 09:18:01
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.HelpScout = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const CountriesCodes_1 = require("./CountriesCodes");
  const ConversationDescription_1 = require("./ConversationDescription");
  const CustomerDescription_1 = require("./CustomerDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const MailboxDescription_1 = require("./MailboxDescription");
  const ThreadDescription_1 = require("./ThreadDescription");
  class HelpScout {
      constructor() {
          this.description = {
              displayName: 'HelpScout',
              name: 'helpScout',
              icon: 'file:helpScout.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume HelpScout API',
              defaults: {
                  name: 'HelpScout',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'helpScoutOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Conversation',
                              value: 'conversation',
                          },
                          {
                              name: 'Customer',
                              value: 'customer',
                          },
                          {
                              name: 'Mailbox',
                              value: 'mailbox',
                          },
                          {
                              name: 'Thread',
                              value: 'thread',
                          },
                      ],
                      default: 'conversation',
                  },
                  ...ConversationDescription_1.conversationOperations,
                  ...ConversationDescription_1.conversationFields,
                  ...CustomerDescription_1.customerOperations,
                  ...CustomerDescription_1.customerFields,
                  ...MailboxDescription_1.mailboxOperations,
                  ...MailboxDescription_1.mailboxFields,
                  ...ThreadDescription_1.threadOperations,
                  ...ThreadDescription_1.threadFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCountriesCodes() {
                      const returnData = [];
                      for (const countryCode of CountriesCodes_1.countriesCodes) {
                          const countryCodeName = `${countryCode.name} - ${countryCode.alpha2}`;
                          const countryCodeId = countryCode.alpha2;
                          returnData.push({
                              name: countryCodeName,
                              value: countryCodeId,
                          });
                      }
                      return returnData;
                  },
                  async getTags() {
                      const returnData = [];
                      const tags = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.tags', 'GET', '/v2/tags');
                      for (const tag of tags) {
                          const tagName = tag.name;
                          returnData.push({
                              name: tagName,
                              value: tagName,
                          });
                      }
                      return returnData;
                  },
                  async getMailboxes() {
                      const returnData = [];
                      const mailboxes = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.mailboxes', 'GET', '/v2/mailboxes');
                      for (const mailbox of mailboxes) {
                          const mailboxName = mailbox.name;
                          const mailboxId = mailbox.id;
                          returnData.push({
                              name: mailboxName,
                              value: mailboxId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          var _a, _b;
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'conversation') {
                      if (operation === 'create') {
                          const mailboxId = this.getNodeParameter('mailboxId', i);
                          const status = this.getNodeParameter('status', i);
                          const subject = this.getNodeParameter('subject', i);
                          const type = this.getNodeParameter('type', i);
                          const resolveData = this.getNodeParameter('resolveData', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const threads = this.getNodeParameter('threadsUi', i)
                              .threadsValues;
                          const body = {
                              mailboxId,
                              status,
                              subject,
                              type,
                          };
                          Object.assign(body, additionalFields);
                          if (additionalFields.customerId) {
                              body.customer = {
                                  id: additionalFields.customerId,
                              };
                              delete body.customerId;
                          }
                          if (additionalFields.customerEmail) {
                              body.customer = {
                                  email: additionalFields.customerEmail,
                              };
                              delete body.customerEmail;
                          }
                          if (body.customer === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Either customer email or customer ID must be set', { itemIndex: i });
                          }
                          if (threads) {
                              for (let index = 0; index < threads.length; index++) {
                                  if (threads[index].type === '' || threads[index].text === '') {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Chat Threads cannot be empty');
                                  }
                                  if (threads[index].type !== 'note') {
                                      threads[index].customer = body.customer;
                                  }
                              }
                              body.threads = threads;
                          }
                          responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'POST', '/v2/conversations', body, qs, undefined, { resolveWithFullResponse: true });
                          const id = responseData.headers['resource-id'];
                          const uri = responseData.headers.location;
                          if (resolveData) {
                              responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'GET', '', {}, {}, uri);
                          }
                          else {
                              responseData = {
                                  id,
                                  uri,
                              };
                          }
                      }
                      if (operation === 'delete') {
                          const conversationId = this.getNodeParameter('conversationId', i);
                          responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'DELETE', `/v2/conversations/${conversationId}`);
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const conversationId = this.getNodeParameter('conversationId', i);
                          responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'GET', `/v2/conversations/${conversationId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.tags) {
                              qs.tag = options.tags.toString();
                          }
                          Object.assign(qs, options);
                          delete qs.tags;
                          if (returnAll) {
                              responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.conversations', 'GET', '/v2/conversations', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.conversations', 'GET', '/v2/conversations', {}, qs);
                              responseData = responseData.splice(0, qs.limit);
                          }
                      }
                  }
                  if (resource === 'customer') {
                      if (operation === 'create') {
                          const resolveData = this.getNodeParameter('resolveData', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const chats = this.getNodeParameter('chatsUi', i)
                              .chatsValues;
                          const address = this.getNodeParameter('addressUi', i)
                              .addressValue;
                          const emails = this.getNodeParameter('emailsUi', i)
                              .emailsValues;
                          const phones = this.getNodeParameter('phonesUi', i)
                              .phonesValues;
                          const socialProfiles = this.getNodeParameter('socialProfilesUi', i)
                              .socialProfilesValues;
                          const websites = this.getNodeParameter('websitesUi', i)
                              .websitesValues;
                          let body = {};
                          body = Object.assign({}, additionalFields);
                          if (body.age) {
                              body.age = body.age.toString();
                          }
                          if (chats) {
                              body.chats = chats;
                          }
                          if (address) {
                              body.address = address;
                              body.address.lines = [address.line1, address.line2];
                          }
                          if (emails) {
                              body.emails = emails;
                          }
                          if (phones) {
                              body.phones = phones;
                          }
                          if (socialProfiles) {
                              body.socialProfiles = socialProfiles;
                          }
                          if (websites) {
                              body.websites = websites;
                          }
                          if (Object.keys(body).length === 0) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You have to set at least one field', {
                                  itemIndex: i,
                              });
                          }
                          responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'POST', '/v2/customers', body, qs, undefined, { resolveWithFullResponse: true });
                          const id = responseData.headers['resource-id'];
                          const uri = responseData.headers.location;
                          if (resolveData) {
                              responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'GET', '', {}, {}, uri);
                          }
                          else {
                              responseData = {
                                  id,
                                  uri,
                              };
                          }
                      }
                      if (operation === 'properties') {
                          responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.customer-properties', 'GET', '/v2/customer-properties', {}, qs);
                      }
                      if (operation === 'get') {
                          const customerId = this.getNodeParameter('customerId', i);
                          responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'GET', `/v2/customers/${customerId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          Object.assign(qs, options);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.customers', 'GET', '/v2/customers', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.customers', 'GET', '/v2/customers', {}, qs);
                              responseData = responseData.splice(0, qs.limit);
                          }
                      }
                      if (operation === 'update') {
                          const customerId = this.getNodeParameter('customerId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          let body = {};
                          body = Object.assign({}, updateFields);
                          if (body.age) {
                              body.age = body.age.toString();
                          }
                          if (Object.keys(body).length === 0) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You have to set at least one field', {
                                  itemIndex: i,
                              });
                          }
                          responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'PUT', `/v2/customers/${customerId}`, body, qs, undefined, { resolveWithFullResponse: true });
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'mailbox') {
                      if (operation === 'get') {
                          const mailboxId = this.getNodeParameter('mailboxId', i);
                          responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'GET', `/v2/mailboxes/${mailboxId}`, {}, qs);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.mailboxes', 'GET', '/v2/mailboxes', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.mailboxes', 'GET', '/v2/mailboxes', {}, qs);
                              responseData = responseData.splice(0, qs.limit);
                          }
                      }
                  }
                  if (resource === 'thread') {
                      if (operation === 'create') {
                          const conversationId = this.getNodeParameter('conversationId', i);
                          const text = this.getNodeParameter('text', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const attachments = this.getNodeParameter('attachmentsUi', i);
                          const body = {
                              text,
                              attachments: [],
                          };
                          Object.assign(body, additionalFields);
                          if (additionalFields.customerId) {
                              body.customer = {
                                  id: additionalFields.customerId,
                              };
                              delete body.customerId;
                          }
                          if (additionalFields.customerEmail) {
                              body.customer = {
                                  email: additionalFields.customerEmail,
                              };
                              delete body.customerEmail;
                          }
                          if (body.customer === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Either customer email or customer ID must be set', { itemIndex: i });
                          }
                          if (attachments) {
                              if (attachments.attachmentsValues &&
                                  attachments.attachmentsValues.length !== 0) {
                                  (_a = body.attachments) === null || _a === void 0 ? void 0 : _a.push.apply(body.attachments, attachments.attachmentsValues);
                              }
                              if (attachments.attachmentsBinary &&
                                  attachments.attachmentsBinary.length !== 0 &&
                                  items[i].binary) {
                                  const mapFunction = (value) => {
                                      const binaryProperty = items[i].binary[value.property];
                                      if (binaryProperty) {
                                          return {
                                              fileName: binaryProperty.fileName || 'unknown',
                                              data: binaryProperty.data,
                                              mimeType: binaryProperty.mimeType,
                                          };
                                      }
                                      else {
                                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary property ${value.property} does not exist on input`, { itemIndex: i });
                                      }
                                  };
                                  (_b = body.attachments) === null || _b === void 0 ? void 0 : _b.push.apply(body.attachments, attachments.attachmentsBinary.map(mapFunction));
                              }
                          }
                          responseData = await GenericFunctions_1.helpscoutApiRequest.call(this, 'POST', `/v2/conversations/${conversationId}/chats`, body);
                          responseData = { success: true };
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const conversationId = this.getNodeParameter('conversationId', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.threads', 'GET', `/v2/conversations/${conversationId}/threads`);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.helpscoutApiRequestAllItems.call(this, '_embedded.threads', 'GET', `/v2/conversations/${conversationId}/threads`, {}, qs);
                              responseData = responseData.splice(0, qs.limit);
                          }
                      }
                  }
              }
              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.HelpScout = HelpScout;
  //# sourceMappingURL=HelpScout.node.js.map

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

  # Help Scout Trigger node

  [Help Scout](https://www.helpscout.com/){:target=_blank .external-link} is a help desk software that provides an email-based customer support platform, knowledge base tool, and an embeddable search/contact widget for customer service professionals.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"9d387ab1-9f10-4f95-a464-3d2c1670d374","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"832bef5180b250a201d77ae853f8bf8730df5f1883e6e6ab19d5fcae745f3675"}}


node_type: n8n-nodes-base.HomeAssistant
name: HomeAssistant
display_name: Home Assistant
description: Consume Home Assistant API
category: output
icon: file:homeAssistant.svg
code_hash: db530f5f43a4c0a938e63f71c6392dc711b44a2ecca9f17bc16c60b9b2d5896a
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.homeassistant
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:01
updated_at: 2025-06-08 09:18:01
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.HomeAssistant = void 0;
  const ConfigDescription_1 = require("./ConfigDescription");
  const ServiceDescription_1 = require("./ServiceDescription");
  const StateDescription_1 = require("./StateDescription");
  const EventDescription_1 = require("./EventDescription");
  const LogDescription_1 = require("./LogDescription");
  const TemplateDescription_1 = require("./TemplateDescription");
  const HistoryDescription_1 = require("./HistoryDescription");
  const CameraProxyDescription_1 = require("./CameraProxyDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  class HomeAssistant {
      constructor() {
          this.description = {
              displayName: 'Home Assistant',
              name: 'homeAssistant',
              icon: 'file:homeAssistant.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Home Assistant API',
              defaults: {
                  name: 'Home Assistant',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'homeAssistantApi',
                      required: true,
                      testedBy: 'homeAssistantApiTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Camera Proxy',
                              value: 'cameraProxy',
                          },
                          {
                              name: 'Config',
                              value: 'config',
                          },
                          {
                              name: 'Event',
                              value: 'event',
                          },
                          {
                              name: 'Log',
                              value: 'log',
                          },
                          {
                              name: 'Service',
                              value: 'service',
                          },
                          {
                              name: 'State',
                              value: 'state',
                          },
                          {
                              name: 'Template',
                              value: 'template',
                          },
                      ],
                      default: 'config',
                  },
                  ...CameraProxyDescription_1.cameraProxyOperations,
                  ...CameraProxyDescription_1.cameraProxyFields,
                  ...ConfigDescription_1.configOperations,
                  ...EventDescription_1.eventOperations,
                  ...EventDescription_1.eventFields,
                  ...HistoryDescription_1.historyOperations,
                  ...HistoryDescription_1.historyFields,
                  ...LogDescription_1.logOperations,
                  ...LogDescription_1.logFields,
                  ...ServiceDescription_1.serviceOperations,
                  ...ServiceDescription_1.serviceFields,
                  ...StateDescription_1.stateOperations,
                  ...StateDescription_1.stateFields,
                  ...TemplateDescription_1.templateOperations,
                  ...TemplateDescription_1.templateFields,
              ],
          };
          this.methods = {
              credentialTest: {
                  async homeAssistantApiTest(credential) {
                      const credentials = credential.data;
                      const options = {
                          method: 'GET',
                          headers: {
                              Authorization: `Bearer ${credentials.accessToken}`,
                          },
                          uri: `${credentials.ssl === true ? 'https' : 'http'}://${credentials.host}:${credentials.port || '8123'}/api/`,
                          json: true,
                          timeout: 5000,
                      };
                      try {
                          const response = await this.helpers.request(options);
                          if (!response.message) {
                              return {
                                  status: 'Error',
                                  message: `Token is not valid: ${response.error}`,
                              };
                          }
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: `${error.statusCode === 401 ? 'Token is' : 'Settings are'} not valid: ${error}`,
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Authentication successful!',
                      };
                  },
              },
              loadOptions: {
                  async getAllEntities() {
                      return GenericFunctions_1.getHomeAssistantEntities.call(this);
                  },
                  async getCameraEntities() {
                      return GenericFunctions_1.getHomeAssistantEntities.call(this, 'camera');
                  },
                  async getDomains() {
                      return GenericFunctions_1.getHomeAssistantServices.call(this);
                  },
                  async getDomainServices() {
                      const currentDomain = this.getCurrentNodeParameter('domain');
                      if (currentDomain) {
                          return GenericFunctions_1.getHomeAssistantServices.call(this, currentDomain);
                      }
                      else {
                          return [];
                      }
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const qs = {};
          let responseData;
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'config') {
                      if (operation === 'get') {
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', '/config');
                      }
                      else if (operation === 'check') {
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'POST', '/config/core/check_config');
                      }
                  }
                  else if (resource === 'service') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          responseData = (await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', '/services'));
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                      else if (operation === 'call') {
                          const domain = this.getNodeParameter('domain', i);
                          const service = this.getNodeParameter('service', i);
                          const serviceAttributes = this.getNodeParameter('serviceAttributes', i);
                          const body = {};
                          if (Object.entries(serviceAttributes).length) {
                              if (serviceAttributes.attributes !== undefined) {
                                  serviceAttributes.attributes.map((attribute) => {
                                      body[attribute.name] = attribute.value;
                                  });
                              }
                          }
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'POST', `/services/${domain}/${service}`, body);
                          if (Array.isArray(responseData) && responseData.length === 0) {
                              responseData = {};
                          }
                      }
                  }
                  else if (resource === 'state') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          responseData = (await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', '/states'));
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                      else if (operation === 'get') {
                          const entityId = this.getNodeParameter('entityId', i);
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', `/states/${entityId}`);
                      }
                      else if (operation === 'upsert') {
                          const entityId = this.getNodeParameter('entityId', i);
                          const state = this.getNodeParameter('state', i);
                          const stateAttributes = this.getNodeParameter('stateAttributes', i);
                          const body = {
                              state,
                              attributes: {},
                          };
                          if (Object.entries(stateAttributes).length) {
                              if (stateAttributes.attributes !== undefined) {
                                  stateAttributes.attributes.map((attribute) => {
                                      body.attributes[attribute.name] = attribute.value;
                                  });
                              }
                          }
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'POST', `/states/${entityId}`, body);
                      }
                  }
                  else if (resource === 'event') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          responseData = (await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', '/events'));
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                      else if (operation === 'create') {
                          const eventType = this.getNodeParameter('eventType', i);
                          const eventAttributes = this.getNodeParameter('eventAttributes', i);
                          const body = {};
                          if (Object.entries(eventAttributes).length) {
                              if (eventAttributes.attributes !== undefined) {
                                  eventAttributes.attributes.map((attribute) => {
                                      body[attribute.name] = attribute.value;
                                  });
                              }
                          }
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'POST', `/events/${eventType}`, body);
                      }
                  }
                  else if (resource === 'log') {
                      if (operation === 'getErroLogs') {
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', '/error_log');
                          if (responseData) {
                              responseData = {
                                  errorLog: responseData,
                              };
                          }
                      }
                      else if (operation === 'getLogbookEntries') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          let endpoint = '/logbook';
                          if (Object.entries(additionalFields).length) {
                              if (additionalFields.startTime) {
                                  endpoint = `/logbook/${additionalFields.startTime}`;
                              }
                              if (additionalFields.endTime) {
                                  qs.end_time = additionalFields.endTime;
                              }
                              if (additionalFields.entityId) {
                                  qs.entity = additionalFields.entityId;
                              }
                          }
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', endpoint, {}, qs);
                      }
                  }
                  else if (resource === 'template') {
                      if (operation === 'create') {
                          const body = {
                              template: this.getNodeParameter('template', i),
                          };
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'POST', '/template', body);
                          if (responseData) {
                              responseData = { renderedTemplate: responseData };
                          }
                      }
                  }
                  else if (resource === 'history') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          let endpoint = '/history/period';
                          if (Object.entries(additionalFields).length) {
                              if (additionalFields.startTime) {
                                  endpoint = `/history/period/${additionalFields.startTime}`;
                              }
                              if (additionalFields.endTime) {
                                  qs.end_time = additionalFields.endTime;
                              }
                              if (additionalFields.entityIds) {
                                  qs.filter_entity_id = additionalFields.entityIds;
                              }
                              if (additionalFields.minimalResponse === true) {
                                  qs.minimal_response = additionalFields.minimalResponse;
                              }
                              if (additionalFields.significantChangesOnly === true) {
                                  qs.significant_changes_only = additionalFields.significantChangesOnly;
                              }
                          }
                          responseData = (await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', endpoint, {}, qs));
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                  }
                  else if (resource === 'cameraProxy') {
                      if (operation === 'getScreenshot') {
                          const cameraEntityId = this.getNodeParameter('cameraEntityId', i);
                          const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                          const endpoint = `/camera_proxy/${cameraEntityId}`;
                          let mimeType;
                          responseData = await GenericFunctions_1.homeAssistantApiRequest.call(this, 'GET', endpoint, {}, {}, undefined, {
                              encoding: null,
                              resolveWithFullResponse: true,
                          });
                          const newItem = {
                              json: items[i].json,
                              binary: {},
                          };
                          if (mimeType === undefined && responseData.headers['content-type']) {
                              mimeType = responseData.headers['content-type'];
                          }
                          if (items[i].binary !== undefined && newItem.binary) {
                              Object.assign(newItem.binary, items[i].binary);
                          }
                          items[i] = newItem;
                          const data = Buffer.from(responseData.body);
                          items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data, 'screenshot.jpg', mimeType);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      if (resource === 'cameraProxy' && operation === 'get') {
                          items[i].json = { error: error.message };
                      }
                      else {
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      continue;
                  }
                  throw error;
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          if (resource === 'cameraProxy' && operation === 'getScreenshot') {
              return [items];
          }
          else {
              return [returnData];
          }
      }
  }
  exports.HomeAssistant = HomeAssistant;
  //# sourceMappingURL=HomeAssistant.node.js.map

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

  # Home Assistant node

  Use the Home Assistant node to automate work in Home Assistant, and integrate Home Assistant with other applications. n8n has built-in support for a wide range of Home Assistant features, including getting, creating, and checking camera proxies, configurations, logs, services, and templates. 

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

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

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

  ## Operations

  * Camera Proxy
      * Get the camera screenshot
  * Config
      * Get the configuration
      * Check the configuration
  * Event
      * Create an event
      * Get all events
  * Log
      * Get a log for a specific entity
      * Get all logs
  * Service
      * Call a service within a specific domain
      * Get all services
  * State
      * Create a new record, or update the current one if it already exists (upsert)
      * Get a state for a specific entity
      * Get all states
  * Template
      * Create a template

  ## Templates and examples

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

  ## Related resources

  Refer to [Home Assistant's documentation](https://developers.home-assistant.io/docs/api/rest/){:target=_blank .external-link} for more information about the service.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"5529f9c8-06e5-49b0-8715-c611ee2ca3fc","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"982da88e0d56d0ef49199c30bd72b20b1a5a4c7c9a0be3cf0082af51c76fe8b8"}}


node_type: n8n-nodes-base.HtmlExtract
name: HtmlExtract
display_name: HTML Extract
description: Extracts data from HTML
category: transform
icon: fa:cut
code_hash: a9275186152c41bb3aea3d6c84c440e8b975b5b1e218d2bd3eafd12cc172cb7c
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:02
updated_at: 2025-06-08 09:18:02
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.HtmlExtract = void 0;
  const cheerio_1 = __importDefault(require("cheerio"));
  const n8n_workflow_1 = require("n8n-workflow");
  const get_1 = __importDefault(require("lodash/get"));
  const extractFunctions = {
      attribute: ($, valueData) => $.attr(valueData.attribute),
      html: ($, _valueData) => $.html() || undefined,
      text: ($, _valueData) => $.text(),
      value: ($, _valueData) => $.val(),
  };
  function getValue($, valueData, options) {
      const value = extractFunctions[valueData.returnValue]($, valueData);
      if (options.trimValues === false || value === undefined) {
          return value;
      }
      return value.trim();
  }
  class HtmlExtract {
      constructor() {
          this.description = {
              displayName: 'HTML Extract',
              name: 'htmlExtract',
              icon: 'fa:cut',
              group: ['transform'],
              version: 1,
              hidden: true,
              subtitle: '={{$parameter["sourceData"] + ": " + $parameter["dataPropertyName"]}}',
              description: 'Extracts data from HTML',
              defaults: {
                  name: 'HTML Extract',
                  color: '#333377',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Source Data',
                      name: 'sourceData',
                      type: 'options',
                      options: [
                          {
                              name: 'Binary',
                              value: 'binary',
                          },
                          {
                              name: 'JSON',
                              value: 'json',
                          },
                      ],
                      default: 'json',
                      description: 'If HTML should be read from binary or JSON data',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'dataPropertyName',
                      type: 'string',
                      displayOptions: {
                          show: {
                              sourceData: ['binary'],
                          },
                      },
                      default: 'data',
                      required: true,
                      description: 'Name of the binary property in which the HTML to extract the data from can be found',
                  },
                  {
                      displayName: 'JSON Property',
                      name: 'dataPropertyName',
                      type: 'string',
                      displayOptions: {
                          show: {
                              sourceData: ['json'],
                          },
                      },
                      default: 'data',
                      required: true,
                      description: 'Name of the JSON property in which the HTML to extract the data from can be found. The property can either contain a string or an array of strings.',
                  },
                  {
                      displayName: 'Extraction Values',
                      name: 'extractionValues',
                      placeholder: 'Add Value',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                      },
                      default: {},
                      options: [
                          {
                              name: 'values',
                              displayName: 'Values',
                              values: [
                                  {
                                      displayName: 'Key',
                                      name: 'key',
                                      type: 'string',
                                      default: '',
                                      description: 'The key under which the extracted value should be saved',
                                  },
                                  {
                                      displayName: 'CSS Selector',
                                      name: 'cssSelector',
                                      type: 'string',
                                      default: '',
                                      placeholder: '.price',
                                      description: 'The CSS selector to use',
                                  },
                                  {
                                      displayName: 'Return Value',
                                      name: 'returnValue',
                                      type: 'options',
                                      options: [
                                          {
                                              name: 'Attribute',
                                              value: 'attribute',
                                              description: 'Get an attribute value like "class" from an element',
                                          },
                                          {
                                              name: 'HTML',
                                              value: 'html',
                                              description: 'Get the HTML the element contains',
                                          },
                                          {
                                              name: 'Text',
                                              value: 'text',
                                              description: 'Get only the text content of the element',
                                          },
                                          {
                                              name: 'Value',
                                              value: 'value',
                                              description: 'Get value of an input, select or textarea',
                                          },
                                      ],
                                      default: 'text',
                                      description: 'What kind of data should be returned',
                                  },
                                  {
                                      displayName: 'Attribute',
                                      name: 'attribute',
                                      type: 'string',
                                      displayOptions: {
                                          show: {
                                              returnValue: ['attribute'],
                                          },
                                      },
                                      default: '',
                                      placeholder: 'class',
                                      description: 'The name of the attribute to return the value off',
                                  },
                                  {
                                      displayName: 'Return Array',
                                      name: 'returnArray',
                                      type: 'boolean',
                                      default: false,
                                      description: 'Whether to return the values as an array so if multiple ones get found they also get returned separately. If not set all will be returned as a single string.',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Trim Values',
                              name: 'trimValues',
                              type: 'boolean',
                              default: true,
                              description: 'Whether to remove automatically all spaces and newlines from the beginning and end of the values',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let item;
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              try {
                  const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex);
                  const extractionValues = this.getNodeParameter('extractionValues', itemIndex);
                  const options = this.getNodeParameter('options', itemIndex, {});
                  const sourceData = this.getNodeParameter('sourceData', itemIndex);
                  item = items[itemIndex];
                  let htmlArray = [];
                  if (sourceData === 'json') {
                      const data = (0, get_1.default)(item.json, dataPropertyName, undefined);
                      if (data === undefined) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No property named "${dataPropertyName}" exists!`, { itemIndex });
                      }
                      htmlArray = data;
                  }
                  else {
                      this.helpers.assertBinaryData(itemIndex, dataPropertyName);
                      const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, dataPropertyName);
                      htmlArray = binaryDataBuffer.toString('utf-8');
                  }
                  if (!Array.isArray(htmlArray)) {
                      htmlArray = [htmlArray];
                  }
                  for (const html of htmlArray) {
                      const $ = cheerio_1.default.load(html);
                      const newItem = {
                          json: {},
                          pairedItem: {
                              item: itemIndex,
                          },
                      };
                      let htmlElement;
                      for (const valueData of extractionValues.values) {
                          htmlElement = $(valueData.cssSelector);
                          if (valueData.returnArray) {
                              newItem.json[valueData.key] = [];
                              htmlElement.each((i, el) => {
                                  newItem.json[valueData.key].push(getValue($(el), valueData, options));
                              });
                          }
                          else {
                              newItem.json[valueData.key] = getValue(htmlElement, valueData, options);
                          }
                      }
                      returnData.push(newItem);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({
                          json: {
                              error: error.message,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.HtmlExtract = HtmlExtract;
  //# sourceMappingURL=HtmlExtract.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"fff36cb0-10d4-4b26-8bc7-46d45902d2b9","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"7c1c0d66048a8b99987da111e87609e92d77753c3f65a9fa5cd9ba81fa844394"}}


node_type: n8n-nodes-base.Html
name: Html
display_name: HTML
description: Work with HTML
category: transform
icon: file:html.svg
code_hash: 9531d0a56d4f238a5c8fd64ea0b1c85308c7aa09d60d54033bd0365cbf8ebbe4
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.html
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:02
updated_at: 2025-06-08 09:18:02
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.Html = exports.capitalizeHeader = void 0;
  const cheerio_1 = __importDefault(require("cheerio"));
  const n8n_workflow_1 = require("n8n-workflow");
  const placeholder_1 = require("./placeholder");
  const utils_1 = require("./utils");
  const utilities_1 = require("../../utils/utilities");
  const capitalizeHeader = (header, capitalize) => {
      if (!capitalize)
          return header;
      return header
          .split('_')
          .filter((word) => word)
          .map((word) => word[0].toUpperCase() + word.slice(1))
          .join(' ');
  };
  exports.capitalizeHeader = capitalizeHeader;
  class Html {
      constructor() {
          this.description = {
              displayName: 'HTML',
              name: 'html',
              icon: 'file:html.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{ $parameter["operation"] }}',
              description: 'Work with HTML',
              defaults: {
                  name: 'HTML',
              },
              inputs: ['main'],
              outputs: ['main'],
              parameterPane: 'wide',
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Generate HTML Template',
                              value: 'generateHtmlTemplate',
                              action: 'Generate HTML template',
                          },
                          {
                              name: 'Extract HTML Content',
                              value: 'extractHtmlContent',
                              action: 'Extract HTML Content',
                          },
                          {
                              name: 'Convert to HTML Table',
                              value: 'convertToHtmlTable',
                              action: 'Convert to HTML Table',
                          },
                      ],
                      default: 'generateHtmlTemplate',
                  },
                  {
                      displayName: 'HTML Template',
                      name: 'html',
                      typeOptions: {
                          editor: 'htmlEditor',
                      },
                      type: 'string',
                      default: placeholder_1.placeholder,
                      noDataExpression: true,
                      description: 'HTML template to render',
                      displayOptions: {
                          show: {
                              operation: ['generateHtmlTemplate'],
                          },
                      },
                  },
                  {
                      displayName: '<b>Tips</b>: Type ctrl+space for completions. Use <code>{{ }}</code> for expressions and <code>&lt;style&gt;</code> tags for CSS. JS in <code>&lt;script&gt;</code> tags is included but not executed in n8n.',
                      name: 'notice',
                      type: 'notice',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['generateHtmlTemplate'],
                          },
                      },
                  },
                  {
                      displayName: 'Source Data',
                      name: 'sourceData',
                      type: 'options',
                      options: [
                          {
                              name: 'Binary',
                              value: 'binary',
                          },
                          {
                              name: 'JSON',
                              value: 'json',
                          },
                      ],
                      default: 'json',
                      description: 'If HTML should be read from binary or JSON data',
                      displayOptions: {
                          show: {
                              operation: ['extractHtmlContent'],
                          },
                      },
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'dataPropertyName',
                      type: 'string',
                      requiresDataPath: 'single',
                      displayOptions: {
                          show: {
                              operation: ['extractHtmlContent'],
                              sourceData: ['binary'],
                          },
                      },
                      default: 'data',
                      required: true,
                      description: 'Name of the binary property in which the HTML to extract the data from can be found',
                  },
                  {
                      displayName: 'JSON Property',
                      name: 'dataPropertyName',
                      type: 'string',
                      requiresDataPath: 'single',
                      displayOptions: {
                          show: {
                              operation: ['extractHtmlContent'],
                              sourceData: ['json'],
                          },
                      },
                      default: 'data',
                      required: true,
                      description: 'Name of the JSON property in which the HTML to extract the data from can be found. The property can either contain a string or an array of strings.',
                  },
                  {
                      displayName: 'Extraction Values',
                      name: 'extractionValues',
                      placeholder: 'Add Value',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              operation: ['extractHtmlContent'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              name: 'values',
                              displayName: 'Values',
                              values: [
                                  {
                                      displayName: 'Key',
                                      name: 'key',
                                      type: 'string',
                                      default: '',
                                      description: 'The key under which the extracted value should be saved',
                                  },
                                  {
                                      displayName: 'CSS Selector',
                                      name: 'cssSelector',
                                      type: 'string',
                                      default: '',
                                      placeholder: '.price',
                                      description: 'The CSS selector to use',
                                  },
                                  {
                                      displayName: 'Return Value',
                                      name: 'returnValue',
                                      type: 'options',
                                      options: [
                                          {
                                              name: 'Attribute',
                                              value: 'attribute',
                                              description: 'Get an attribute value like "class" from an element',
                                          },
                                          {
                                              name: 'HTML',
                                              value: 'html',
                                              description: 'Get the HTML the element contains',
                                          },
                                          {
                                              name: 'Text',
                                              value: 'text',
                                              description: 'Get only the text content of the element',
                                          },
                                          {
                                              name: 'Value',
                                              value: 'value',
                                              description: 'Get value of an input, select or textarea',
                                          },
                                      ],
                                      default: 'text',
                                      description: 'What kind of data should be returned',
                                  },
                                  {
                                      displayName: 'Attribute',
                                      name: 'attribute',
                                      type: 'string',
                                      displayOptions: {
                                          show: {
                                              returnValue: ['attribute'],
                                          },
                                      },
                                      default: '',
                                      placeholder: 'class',
                                      description: 'The name of the attribute to return the value off',
                                  },
                                  {
                                      displayName: 'Return Array',
                                      name: 'returnArray',
                                      type: 'boolean',
                                      default: false,
                                      description: 'Whether to return the values as an array so if multiple ones get found they also get returned separately. If not set all will be returned as a single string.',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['extractHtmlContent'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Trim Values',
                              name: 'trimValues',
                              type: 'boolean',
                              default: true,
                              description: 'Whether to remove automatically all spaces and newlines from the beginning and end of the values',
                          },
                      ],
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['convertToHtmlTable'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Capitalize Headers',
                              name: 'capitalize',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to capitalize the headers',
                          },
                          {
                              displayName: 'Custom Styling',
                              name: 'customStyling',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to use custom styling',
                          },
                          {
                              displayName: 'Caption',
                              name: 'caption',
                              type: 'string',
                              default: '',
                              description: 'Caption to add to the table',
                          },
                          {
                              displayName: 'Table Attributes',
                              name: 'tableAttributes',
                              type: 'string',
                              default: '',
                              description: 'Attributes to attach to the table',
                              placeholder: 'e.g. style="padding:10px"',
                          },
                          {
                              displayName: 'Header Attributes',
                              name: 'headerAttributes',
                              type: 'string',
                              default: '',
                              description: 'Attributes to attach to the table header',
                              placeholder: 'e.g. style="padding:10px"',
                          },
                          {
                              displayName: 'Row Attributes',
                              name: 'rowAttributes',
                              type: 'string',
                              default: '',
                              description: 'Attributes to attach to the table row',
                              placeholder: 'e.g. style="padding:10px"',
                          },
                          {
                              displayName: 'Cell Attributes',
                              name: 'cellAttributes',
                              type: 'string',
                              default: '',
                              description: 'Attributes to attach to the table cell',
                              placeholder: 'e.g. style="padding:10px"',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const operation = this.getNodeParameter('operation', 0);
          if (operation === 'convertToHtmlTable' && items.length) {
              let table = '';
              const options = this.getNodeParameter('options', 0);
              let tableStyle = '';
              let headerStyle = '';
              let cellStyle = '';
              if (!options.customStyling) {
                  tableStyle = "style='border-spacing:0; font-family:helvetica,arial,sans-serif'";
                  headerStyle =
                      "style='margin:0; padding:7px 20px 7px 0px; border-bottom:1px solid #eee; text-align:left; color:#888; font-weight:normal'";
                  cellStyle = "style='margin:0; padding:7px 20px 7px 0px; border-bottom:1px solid #eee'";
              }
              const tableAttributes = options.tableAttributes || '';
              const headerAttributes = options.headerAttributes || '';
              const itemsData = [];
              const itemsKeys = new Set();
              for (const entry of items) {
                  itemsData.push(entry.json);
                  for (const key of Object.keys(entry.json)) {
                      itemsKeys.add(key);
                  }
              }
              const headers = Array.from(itemsKeys);
              table += `<table ${tableStyle} ${tableAttributes}>`;
              if (options.caption) {
                  table += `<caption>${options.caption}</caption>`;
              }
              table += `<thead ${headerStyle} ${headerAttributes}>`;
              table += '<tr>';
              table += headers
                  .map((header) => '<th>' + (0, exports.capitalizeHeader)(header, options.capitalize) + '</th>')
                  .join('');
              table += '</tr>';
              table += '</thead>';
              table += '<tbody>';
              itemsData.forEach((entry, entryIndex) => {
                  const rowsAttributes = this.getNodeParameter('options.rowsAttributes', entryIndex, '');
                  table += `<tr  ${rowsAttributes}>`;
                  const cellsAttributes = this.getNodeParameter('options.cellAttributes', entryIndex, '');
                  table += headers
                      .map((header) => {
                      let td = `<td ${cellStyle} ${cellsAttributes}>`;
                      if (typeof entry[header] === 'boolean') {
                          const isChecked = entry[header] ? 'checked="checked"' : '';
                          td += `<input type="checkbox" ${isChecked}/>`;
                      }
                      else {
                          td += entry[header];
                      }
                      td += '</td>';
                      return td;
                  })
                      .join('');
                  table += '</tr>';
              });
              table += '</tbody>';
              table += '</table>';
              return [
                  [
                      {
                          json: { table },
                          pairedItem: items.map((_item, index) => ({
                              item: index,
                          })),
                      },
                  ],
              ];
          }
          let item;
          const returnData = [];
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              try {
                  if (operation === 'generateHtmlTemplate') {
                      let html = this.getNodeParameter('html', itemIndex);
                      for (const resolvable of (0, utilities_1.getResolvables)(html)) {
                          html = html.replace(resolvable, this.evaluateExpression(resolvable, itemIndex));
                      }
                      const result = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ html }), {
                          itemData: { item: itemIndex },
                      });
                      returnData.push(...result);
                  }
                  else if (operation === 'extractHtmlContent') {
                      const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex);
                      const extractionValues = this.getNodeParameter('extractionValues', itemIndex);
                      const options = this.getNodeParameter('options', itemIndex, {});
                      const sourceData = this.getNodeParameter('sourceData', itemIndex);
                      item = items[itemIndex];
                      let htmlArray = [];
                      if (sourceData === 'json') {
                          if (item.json[dataPropertyName] === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No property named "${dataPropertyName}" exists!`, { itemIndex });
                          }
                          htmlArray = item.json[dataPropertyName];
                      }
                      else {
                          this.helpers.assertBinaryData(itemIndex, dataPropertyName);
                          const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, dataPropertyName);
                          htmlArray = binaryDataBuffer.toString('utf-8');
                      }
                      if (!Array.isArray(htmlArray)) {
                          htmlArray = [htmlArray];
                      }
                      for (const html of htmlArray) {
                          const $ = cheerio_1.default.load(html);
                          const newItem = {
                              json: {},
                              pairedItem: {
                                  item: itemIndex,
                              },
                          };
                          let htmlElement;
                          for (const valueData of extractionValues.values) {
                              htmlElement = $(valueData.cssSelector);
                              if (valueData.returnArray) {
                                  newItem.json[valueData.key] = [];
                                  htmlElement.each((i, el) => {
                                      newItem.json[valueData.key].push((0, utils_1.getValue)($(el), valueData, options));
                                  });
                              }
                              else {
                                  newItem.json[valueData.key] = (0, utils_1.getValue)(htmlElement, valueData, options);
                              }
                          }
                          returnData.push(newItem);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({
                          json: {
                              error: error.message,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Html = Html;
  //# sourceMappingURL=Html.node.js.map

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

  # HTML

  The HTML node provides operations to help you work with HTML in n8n.

  /// note | HTML Extract node
  The HTML node replaces the HTML Extract node from version 0.213.0 on. If you're using an older version of n8n, you can still view the [HTML Extract node documentation](https://github.com/n8n-io/n8n-docs/blob/86fe33b681621e618e3adcab9a27e8605dbc23ad/docs/integrations/builtin/core-nodes/n8n-nodes-base.htmlextract.md){:target=_blank .external-link}.
  ///
  /// warning | Cross-site scripting
  When using the HTML node to generate an HTML template you can introduce [XSS (cross-site scripting)](https://owasp.org/www-community/attacks/xss/){:target=_blank .external-link}. This is a security risk. Be careful with un-trusted inputs.
  ///

  ## Operations

  * [**Generate HTML template**](#generate-html-template): Use this operation to create an HTML template. This allows you to take data from your workflow and output it as HTML.
  * [**Extract HTML content**](#extract-html-content): Extract contents from an HTML-formatted source. The source can be in JSON or a binary file (`.html`).
  * [**Convert to HTML Table**](#convert-to-html-table): Convert content to an HTML table.

  The node parameters and options depend on the operation you select. Refer to the sections below for more details on configuring each operation.

  ## Generate HTML template

  Create an HTML template. This allows you to take data from your workflow and output it as HTML. 

  You can include:

  * Standard HTML
  * CSS in `<style>` tags.
  * JavaScript in `<script>` tags. n8n doesn't execute the JavaScript.
  * Expressions, wrapped in `{{}}`.

  You can use [Expressions](/code/expressions.md) in the template, including n8n's [Built-in methods and variables](/code/builtin/overview.md). 

  ## Extract HTML Content

  Extract contents from an HTML-formatted source. The source can be in JSON or a binary file (`.html`).

  Use these parameters:

  ### Source Data

  Select the source type for your HTML content. Choose between:

  * **JSON**: If you select this source data, enter the **JSON Property**: the name of the input containing the HTML you want to extract. The property can contain a string or an array of strings.
  * **Binary**: If you select this source data, enter the **Input Binary Field**: the name of the input containing the HTML you want to extract. The property can contain a string or an array of strings.

  ### Extraction Values

  - **Key**: Enter the key to save the extracted value under.
  - **CSS Selector**: Enter the CSS selector to search for.
  - **Return Value**: Select the type of data to return. Choose from:
  	- **Attribute**: Return an attribute value like `class` from an element.
  		- If you select this option, enter the name of the **Attribute** to return the value of.
  	- **HTML**: Return the HTML that the element contains.
  	- **Text**: Return the text content of the element.
  		- If you choose this option, you can also enter a comma-separated list of selectors to skip in the **Skip Selectors**.
  	- **Value**: Return the value of an input, select, or text area.
  - **Return Array**: Choose whether to return multiple extraction values as an array (turned on) or as a single string (turned off).

  ### Extract HTML Content options

  You can also configure this operation with these options:

  * **Trim Values**: Controls whether to remove all spaces and newlines from the beginning and end of the values (turned on) or leaves them (turned off).
  * **Clean Up Text**: Controls whether to remove leading whitespaces, trailing whitespaces, and line breaks (newlines) and condense multiple consecutive whitespaces into a single space (turned on) or to leave them as-is (turned off).

  ## Convert to HTML Table

  This operation expects data from another node. It has no parameters. It includes these options:

  * **Capitalize Headers**: Controls whether to capitalize the table's headers (turned on) or not (turned off).
  * **Custom Styling**: Controls whether to use custom styling (turned on) or not (turned off).
  * **Caption**: Enter a caption to add to the table.
  * **Table Attributes**: Enter any attributes to apply to the `<table>`, such as style attributes.
  * **Header Attributes**: Enter any attributes to apply to the table's headers `<th>`.
  * **Row Attributes**: Enter any attributes to apply to the table's rows `<tr>`.
  * **Cell Attributes**: Enter any attributes to apply to the table's cells `<td>`.

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"7f6917ea-7854-4cf1-adc2-b1ef6a066862","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"a29ac165d64e34eda4b23e568c9c146a5ae2f651bdb40f2d6fe3817f86361d40"}}


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

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

  # HTTP Request Tool node

  /// warning | Legacy tool version
  New instances of the HTTP Request tool node that you add to workflows use the standard [HTTP Request](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/index.md) node as a tool. This page is describes the legacy, standalone HTTP Request tool node.

  You can identify which tool version is in your workflow by checking if the node has an **Add option** property when you open the node on the canvas. If that button is present, you're using the new version, not the one described on this page.
  ///

  The HTTP Request tool works just like the [HTTP Request](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/index.md) node, but it's designed to be used with an [AI agent](/glossary.md#ai-agent) as a tool to collect information from a website or API.

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

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

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

  ## Templates and examples

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

  ## Related resources

  --8<-- "_snippets/integrations/builtin/cluster-nodes/tools-link.md"

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"ad056b4d-02d4-405a-9220-e6fb6b9df99e","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"507e29bee8ccbe48c0cdc8e11ae2bd5b826b395c49fb71152dc52c41b9284731"}}


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

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

  # HubSpot Trigger node

  [HubSpot](https://www.hubspot.com/){:target=_blank .external-link} provides tools for social media marketing, content management, web analytics, landing pages, customer support, and search engine optimization.

  /// warning | Webhooks
  If you activate a second trigger, the previous trigger stops working. This is because the trigger registers a new webhook with HubSpot when activated. HubSpot only allows one webhook at a time. 
  ///

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

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

  ## Events

  * Company
  	* Created
  	* Deleted
  	* Property changed
  * Contact
  	* Created
  	* Deleted
  	* Privacy deleted
  	* Property changed
  * Conversation
  	* Created
  	* Deleted
  	* New message
  	* Privacy deletion
  	* Property changed
  * Deal
  	* Created
  	* Deleted
  	* Property changed
  * Ticket
  	* Created
  	* Deleted
  	* Property changed 

  ## Related resources

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

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

  Refer to [HubSpot's documentation](https://developers.hubspot.com/docs/api/overview){:target=_blank .external-link} for details about their API.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"dc755d19-cdb8-49d1-8889-901fee5a2aa8","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"f3fe7022009f98cd01ed02e8abc46b709a483b6ab4461372a9c0869fd785241c"}}


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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"715d7743-345c-41fa-8df5-c952e5393924","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"797f6c4fc71be7f8b961ceb9db1a764233fefabfca567cbc8ca29a2593ea673f"}}


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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"ef290926-1ba3-4bdc-a8a6-98f259b11405","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"c52756ec477bf7462e2e295b1d23029deb6ce2b0575d9bb5400fcf1e6c5619aa"}}


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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"78c1b5a8-830b-4f26-af36-8535736c25a3","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"da33968856e67260ac50c89121c016cb1a160cdce679293a62b6e5430a5de5c5"}}


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

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

  # If

  Use the If node to split a workflow conditionally based on comparison operations.

  ## Add conditions

  Create comparison **Conditions** for your If node.

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

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

  ### Combining conditions

  You can choose to keep data:

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

  ## Templates and examples

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

  ## Branch execution with If and Merge nodes

  --8<-- "_snippets/integrations/builtin/core-nodes/merge/if-merge-branch-execution.md"

  ## Related resources

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

  If you need more than two conditional outputs, use the [Switch node](/integrations/builtin/core-nodes/n8n-nodes-base.switch.md).

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"48e398c3-8996-4585-8ffd-8fbd08ac1d31","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"2852ebbf08c07d30f280d5ddb37d9c4d6280d621b187be5b08ae4f35215dba2f"}}


