# nodes

node_type: n8n-nodes-base.DeepL
name: DeepL
display_name: DeepL
description: Translate data using DeepL
category: Other
icon: file:deepl.svg
code_hash: 2f0799ff8ae4cf89ec968e13020a9731fa3ab1c20901ec795d3ba76c39ab01da
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.DeepL
documentation_title: DeepL node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"deepl","description":"Templates for deepl"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"language","operation":"translate","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:27
updated_at: 2025-06-12 08:58:27
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DeepL = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const TextDescription_1 = require("./TextDescription");
  class DeepL {
      constructor() {
          this.description = {
              displayName: 'DeepL',
              name: 'deepL',
              icon: 'file:deepl.svg',
              group: ['input', 'output'],
              version: 1,
              description: 'Translate data using DeepL',
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              defaults: {
                  name: 'DeepL',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'deepLApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Language',
                              value: 'language',
                          },
                      ],
                      default: 'language',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['language'],
                          },
                      },
                      options: [
                          {
                              name: 'Translate',
                              value: 'translate',
                              description: 'Translate data',
                              action: 'Translate a language',
                          },
                      ],
                      default: 'translate',
                  },
                  ...TextDescription_1.textOperations,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLanguages() {
                      const returnData = [];
                      const languages = await GenericFunctions_1.deepLApiRequest.call(this, 'GET', '/languages', {}, { type: 'target' });
                      for (const language of languages) {
                          returnData.push({
                              name: language.name,
                              value: language.language,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const length = items.length;
          const responseData = [];
          for (let i = 0; i < length; i++) {
              try {
                  const resource = this.getNodeParameter('resource', i);
                  const operation = this.getNodeParameter('operation', i);
                  const additionalFields = this.getNodeParameter('additionalFields', i);
                  if (resource === 'language') {
                      if (operation === 'translate') {
                          let body = {};
                          const text = this.getNodeParameter('text', i);
                          const translateTo = this.getNodeParameter('translateTo', i);
                          body = { target_lang: translateTo, text };
                          if (additionalFields.sourceLang !== undefined) {
                              body.source_lang = ['EN-GB', 'EN-US'].includes(additionalFields.sourceLang)
                                  ? 'EN'
                                  : additionalFields.sourceLang;
                          }
                          const { translations } = await GenericFunctions_1.deepLApiRequest.call(this, 'GET', '/translate', body);
                          const [translation] = translations;
                          const translationJsonArray = this.helpers.returnJsonArray(translation);
                          const executionData = this.helpers.constructExecutionMetaData(translationJsonArray, {
                              itemData: { item: i },
                          });
                          responseData.push(...executionData);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = {
                          json: {},
                          error: error.message,
                          itemIndex: i,
                      };
                      responseData.push(executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [responseData];
      }
  }
  exports.DeepL = DeepL;
  //# sourceMappingURL=DeepL.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DeepLApi = void 0;
  class DeepLApi {
      constructor() {
          this.name = 'deepLApi';
          this.displayName = 'DeepL API';
          this.documentationUrl = 'deepL';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'API Plan',
                  name: 'apiPlan',
                  type: 'options',
                  options: [
                      {
                          name: 'Pro Plan',
                          value: 'pro',
                      },
                      {
                          name: 'Free Plan',
                          value: 'free',
                      },
                  ],
                  default: 'pro',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  qs: {
                      auth_key: '={{$credentials.apiKey}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.apiPlan === "pro" ? "https://api.deepl.com/v2" : "https://api-free.deepl.com/v2" }}',
                  url: '/usage',
              },
          };
      }
  }
  exports.DeepLApi = DeepLApi;
  //# sourceMappingURL=DeepLApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DeepLApi = void 0;
  class DeepLApi {
      constructor() {
          this.name = 'deepLApi';
          this.displayName = 'DeepL API';
          this.documentationUrl = 'deepL';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'API Plan',
                  name: 'apiPlan',
                  type: 'options',
                  options: [
                      {
                          name: 'Pro Plan',
                          value: 'pro',
                      },
                      {
                          name: 'Free Plan',
                          value: 'free',
                      },
                  ],
                  default: 'pro',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  qs: {
                      auth_key: '={{$credentials.apiKey}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.apiPlan === "pro" ? "https://api.deepl.com/v2" : "https://api-free.deepl.com/v2" }}',
                  url: '/usage',
              },
          };
      }
  }
  exports.DeepLApi = DeepLApi;
  //# sourceMappingURL=DeepLApi.credentials.js.map

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

  # DeepL node

  Use the DeepL node to automate work in DeepL, and integrate DeepL with other applications. n8n has built-in support for a wide range of DeepL features, including translating languages.

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

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

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

  ## Operations

  * Language
      * Translate data

  ## Templates and examples

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

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

example_workflow:
  {"name":"DeepL Example Workflow","nodes":[{"parameters":{"resource":"language","operation":"translate","dynamic_property":null},"id":"aof1tgkdcwqbh4k24kqzdo","name":"DeepL","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"language","options":[{"name":"Language","value":"language"}]},{"displayName":"Operation","name":"operation","type":"options","default":"translate","description":"Translate data","options":[{"name":"Translate","value":"translate","description":"Translate data"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...TextDescription_1.textOperations"}]


node_type: n8n-nodes-base.Discord
name: Discord
display_name: Discord
description: Sends data to Discord
category: output
icon: file:discord.svg
code_hash: 4995f9ca5c5b57d2486c2e320cc7505238e7f2260861f7e321b44b45ccabeb00
example_parameters: {"webhookUri":"example-value","text":"example-value","options":{}}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:27
updated_at: 2025-06-12 08:58:27
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Discord = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  class Discord {
      constructor() {
          this.description = {
              displayName: 'Discord',
              name: 'discord',
              icon: 'file:discord.svg',
              group: ['output'],
              version: 1,
              description: 'Sends data to Discord',
              defaults: {
                  name: 'Discord',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Webhook URL',
                      name: 'webhookUri',
                      type: 'string',
                      required: true,
                      default: '',
                      placeholder: 'https://discord.com/api/webhooks/ID/TOKEN',
                  },
                  {
                      displayName: 'Content',
                      name: 'text',
                      type: 'string',
                      typeOptions: {
                          maxValue: 2000,
                      },
                      default: '',
                      placeholder: 'Hello World!',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Allowed Mentions',
                              name: 'allowedMentions',
                              type: 'json',
                              typeOptions: { alwaysOpenEditWindow: true, editor: 'code' },
                              default: '',
                          },
                          {
                              displayName: 'Attachments',
                              name: 'attachments',
                              type: 'json',
                              typeOptions: { alwaysOpenEditWindow: true, editor: 'code' },
                              default: '',
                          },
                          {
                              displayName: 'Avatar URL',
                              name: 'avatarUrl',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Components',
                              name: 'components',
                              type: 'json',
                              typeOptions: { alwaysOpenEditWindow: true, editor: 'code' },
                              default: '',
                          },
                          {
                              displayName: 'Embeds',
                              name: 'embeds',
                              type: 'json',
                              typeOptions: { alwaysOpenEditWindow: true, editor: 'code' },
                              default: '',
                          },
                          {
                              displayName: 'Flags',
                              name: 'flags',
                              type: 'number',
                              default: '',
                          },
                          {
                              displayName: 'JSON Payload',
                              name: 'payloadJson',
                              type: 'json',
                              typeOptions: { alwaysOpenEditWindow: true, editor: 'code' },
                              default: '',
                          },
                          {
                              displayName: 'Username',
                              name: 'username',
                              type: 'string',
                              default: '',
                              placeholder: 'User',
                          },
                          {
                              displayName: 'TTS',
                              name: 'tts',
                              type: 'boolean',
                              default: false,
                              description: 'Whether this message be sent as a Text To Speech message',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          var _a;
          const returnData = [];
          const webhookUri = this.getNodeParameter('webhookUri', 0, '');
          if (!webhookUri)
              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Webhook uri is required.');
          const items = this.getInputData();
          const length = items.length;
          for (let i = 0; i < length; i++) {
              const body = {};
              const iterationWebhookUri = this.getNodeParameter('webhookUri', i);
              body.content = this.getNodeParameter('text', i);
              const options = this.getNodeParameter('options', i);
              if (!body.content && !options.embeds) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Either content or embeds must be set.', {
                      itemIndex: i,
                  });
              }
              if (options.embeds) {
                  try {
                      body.embeds = JSON.parse(options.embeds);
                  }
                  catch (e) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Embeds must be valid JSON.', {
                          itemIndex: i,
                      });
                  }
                  if (!Array.isArray(body.embeds)) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Embeds must be an array of embeds.', {
                          itemIndex: i,
                      });
                  }
              }
              if (options.username) {
                  body.username = options.username;
              }
              if (options.components) {
                  try {
                      body.components = JSON.parse(options.components);
                  }
                  catch (e) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Components must be valid JSON.', {
                          itemIndex: i,
                      });
                  }
              }
              if (options.allowed_mentions) {
                  body.allowed_mentions = (0, n8n_workflow_1.jsonParse)(options.allowed_mentions);
              }
              if (options.avatarUrl) {
                  body.avatar_url = options.avatarUrl;
              }
              if (options.flags) {
                  body.flags = options.flags;
              }
              if (options.tts) {
                  body.tts = options.tts;
              }
              if (options.payloadJson) {
                  body.payload_json = (0, n8n_workflow_1.jsonParse)(options.payloadJson);
              }
              if (options.attachments) {
                  body.attachments = (0, n8n_workflow_1.jsonParse)(options.attachments);
              }
              if (!body.content)
                  delete body.content;
              if (!body.username)
                  delete body.username;
              if (!body.avatar_url)
                  delete body.avatar_url;
              if (!body.embeds)
                  delete body.embeds;
              if (!body.allowed_mentions)
                  delete body.allowed_mentions;
              if (!body.flags)
                  delete body.flags;
              if (!body.components)
                  delete body.components;
              if (!body.payload_json)
                  delete body.payload_json;
              if (!body.attachments)
                  delete body.attachments;
              let requestOptions;
              if (!body.payload_json) {
                  requestOptions = {
                      resolveWithFullResponse: true,
                      method: 'POST',
                      body,
                      uri: iterationWebhookUri,
                      headers: {
                          'content-type': 'application/json; charset=utf-8',
                      },
                      json: true,
                  };
              }
              else {
                  requestOptions = {
                      resolveWithFullResponse: true,
                      method: 'POST',
                      body,
                      uri: iterationWebhookUri,
                      headers: {
                          'content-type': 'multipart/form-data; charset=utf-8',
                      },
                  };
              }
              let maxTries = 5;
              let response;
              do {
                  try {
                      response = await this.helpers.request(requestOptions);
                      const resetAfter = response.headers['x-ratelimit-reset-after'] * 1000;
                      const remainingRatelimit = response.headers['x-ratelimit-remaining'];
                      if (!+remainingRatelimit) {
                          await (0, n8n_workflow_1.sleep)(resetAfter !== null && resetAfter !== void 0 ? resetAfter : 1000);
                      }
                      break;
                  }
                  catch (error) {
                      if (error.statusCode === 429) {
                          const retryAfter = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.headers['retry-after']) || 1000;
                          await (0, n8n_workflow_1.sleep)(+retryAfter);
                          continue;
                      }
                      throw error;
                  }
              } while (--maxTries);
              if (maxTries <= 0) {
                  throw new n8n_workflow_1.NodeApiError(this.getNode(), {
                      error: 'Could not send Webhook message. Max amount of rate-limit retries reached.',
                  });
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Discord = Discord;
  //# sourceMappingURL=Discord.node.js.map

workflow_examples:
  [{"name":"chapter-5.6","workflow":{"nodes":[{"parameters":{"url":"https://internal.users.n8n.cloud/webhook/custom-erp","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParameters":{"parameters":[{"name":"unique_id","value":"<YOUR_UNIQUE_ID_HERE>"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[300,-520],"id":"ada6becf-c320-41a7-bdca-a842ea3ee769","name":"HTTP Request1","credentials":{"httpHeaderAuth":{"id":"sMuanZ4xGobAurzY","name":"Nathan's ABCorp data warehouse account"}}},{"parameters":{"operation":"create","base":{"__rl":true,"value":"app9nOVsRxdypoknP","mode":"list","cachedResultName":"beginner course"},"table":{"__rl":true,"value":"tblTIOsm4BLJD9Tql","mode":"list","cachedResultName":"processingOrders"},"columns":{"mappingMode":"autoMapInputData","value":{},"matchingColumns":[],"schema":[{"id":"orderID","displayName":"orderID","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"number","readOnly":false,"removed":false},{"id":"employeeName","displayName":"employeeName","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"string","readOnly":false,"removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"type":"n8n-nodes-base.airtable","typeVersion":2.1,"position":[1020,-600],"id":"5e60ca72-d773-439c-b39a-4b14c54f795b","name":"Airtable1","credentials":{"airtableTokenApi":{"id":"UT32NHUYnp4pn1H3","name":"Airtable Personal Access Token account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"526cb30c-0f90-4f66-8f98-b64ceb2e52f2","leftValue":"={{ $json.orderStatus }}","rightValue":"processing","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[520,-520],"id":"70e4db65-f827-4e4f-8673-b405b7986d6e","name":"If1"},{"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"type":"n8n-nodes-base.set","typeVersion":3.4,"position":[800,-600],"id":"a3d3dc53-32f1-4f44-bf95-50bc5450d601","name":"Edit Fields1"},{"parameters":{"jsCode":"let items = $input.all();\nlet totalBooked = items.length;\nlet bookedSum = 0;\n\nfor (let i=0; i < items.length; i++) {\n  bookedSum = bookedSum + items[i].json.orderPrice;\n}\n\nreturn [{ json: {totalBooked, bookedSum} }];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[760,-420],"id":"d24ea5e9-c9e6-4d06-b6ee-8db1abd42bc0","name":"Code1"},{"parameters":{"authentication":"webhook","content":"=This week we've {{$json[\"totalBooked\"]}} booked orders with a total value of {{$json[\"bookedSum\"]}}. My Unique ID: {{ $('HTTP Request1').params[\"headerParameters\"][\"parameters\"][0][\"value\"] }}","options":{}},"type":"n8n-nodes-base.discord","typeVersion":2,"position":[1000,-420],"id":"ed380465-c655-4c38-8eb3-2008b9e7869f","name":"Discord1","webhookId":"eff0b651-f0be-4cae-8f18-7d831385be3c","credentials":{"discordWebhookApi":{"id":"lOieo0mIb6h1Wi9R","name":"Discord Webhook account"}}},{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[80,-520],"id":"ffa1a8ce-1a1e-48c4-8a0d-6af28c0447a5","name":"When clicking ‘Execute workflow’"}],"connections":{"HTTP Request1":{"main":[[{"node":"If1","type":"main","index":0}]]},"If1":{"main":[[{"node":"Edit Fields1","type":"main","index":0}],[{"node":"Code1","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Airtable1","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Discord1","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"24789c4d5aa56ca018d140332e7a43fd37dd7af0409453314fff12dc1aeebfa8"}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.discord","version":2,"parameters":{"authentication":"webhook","content":"=This week we've {{$json[\"totalBooked\"]}} booked orders with a total value of {{$json[\"bookedSum\"]}}. My Unique ID: {{ $('HTTP Request1').params[\"headerParameters\"][\"parameters\"][0][\"value\"] }}","options":{}},"position":[1000,-420]}],"connections":{"HTTP Request1":{"main":[[{"node":"If1","type":"main","index":0}]]},"If1":{"main":[[{"node":"Edit Fields1","type":"main","index":0}],[{"node":"Code1","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Airtable1","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Discord1","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"source":"docs/_workflows/courses/level-one/chapter-5/chapter-5.6.json","description":"Workflow example from docs/_workflows/courses/level-one/chapter-5/chapter-5.6.json"},{"name":"finished","workflow":{"nodes":[{"parameters":{"url":"https://internal.users.n8n.cloud/webhook/custom-erp","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParameters":{"parameters":[{"name":"unique_id","value":"4d259ec5241587a0d2820670fc048f0d"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[220,-40],"id":"e1fb70b3-0212-4e78-9976-cb77c69f1a92","name":"HTTP Request","credentials":{"httpHeaderAuth":{"id":"sMuanZ4xGobAurzY","name":"Nathan's ABCorp data warehouse account"}}},{"parameters":{"operation":"create","base":{"__rl":true,"value":"app9nOVsRxdypoknP","mode":"list","cachedResultName":"beginner course"},"table":{"__rl":true,"value":"tblTIOsm4BLJD9Tql","mode":"list","cachedResultName":"processingOrders"},"columns":{"mappingMode":"autoMapInputData","value":{},"matchingColumns":[],"schema":[{"id":"orderID","displayName":"orderID","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"number","readOnly":false,"removed":false},{"id":"employeeName","displayName":"employeeName","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"string","readOnly":false,"removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"type":"n8n-nodes-base.airtable","typeVersion":2.1,"position":[880,-140],"id":"5cef2ef7-98a6-4dc6-bc30-667eba06fd7b","name":"Airtable","credentials":{"airtableTokenApi":{"id":"UT32NHUYnp4pn1H3","name":"Airtable Personal Access Token account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"526cb30c-0f90-4f66-8f98-b64ceb2e52f2","leftValue":"={{ $json.orderStatus }}","rightValue":"processing","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[440,-40],"id":"448b2e3c-569d-42e6-a4b9-57c08b2cac1a","name":"If"},{"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"type":"n8n-nodes-base.set","typeVersion":3.4,"position":[660,-140],"id":"7e2a8092-fb0f-4260-84e8-d796cf14d309","name":"Edit Fields"},{"parameters":{"jsCode":"let items = $input.all();\nlet totalBooked = items.length;\nlet bookedSum = 0;\n\nfor (let i=0; i < items.length; i++) {\n  bookedSum = bookedSum + items[i].json.orderPrice;\n}\n\nreturn [{ json: {totalBooked, bookedSum} }];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[660,60],"id":"26ce1d53-794b-4457-9aa8-0ecf9093b838","name":"Code"},{"parameters":{"authentication":"webhook","content":"=This week we've {{$json[\"totalBooked\"]}} booked orders with a total value of {{$json[\"bookedSum\"]}}. My Unique ID: {{ $('HTTP Request').params[\"headerParameters\"][\"parameters\"][0][\"value\"] }}","options":{}},"type":"n8n-nodes-base.discord","typeVersion":2,"position":[880,60],"id":"d8c0b4b6-3bf1-4055-a03f-f0023337777c","name":"Discord","webhookId":"eff0b651-f0be-4cae-8f18-7d831385be3c","credentials":{"discordWebhookApi":{"id":"lOieo0mIb6h1Wi9R","name":"Discord Webhook account"}}},{"parameters":{"rule":{"interval":[{"field":"weeks","triggerAtDay":[1],"triggerAtHour":9}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[0,-40],"id":"15f0b179-6a43-483b-a522-2b8ba834b795","name":"Schedule Trigger"}],"connections":{"HTTP Request":{"main":[[{"node":"If","type":"main","index":0}]]},"If":{"main":[[{"node":"Edit Fields","type":"main","index":0}],[{"node":"Code","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Airtable","type":"main","index":0}]]},"Code":{"main":[[{"node":"Discord","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"24789c4d5aa56ca018d140332e7a43fd37dd7af0409453314fff12dc1aeebfa8"}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.discord","version":2,"parameters":{"authentication":"webhook","content":"=This week we've {{$json[\"totalBooked\"]}} booked orders with a total value of {{$json[\"bookedSum\"]}}. My Unique ID: {{ $('HTTP Request').params[\"headerParameters\"][\"parameters\"][0][\"value\"] }}","options":{}},"position":[880,60]}],"connections":{"HTTP Request":{"main":[[{"node":"If","type":"main","index":0}]]},"If":{"main":[[{"node":"Edit Fields","type":"main","index":0}],[{"node":"Code","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Airtable","type":"main","index":0}]]},"Code":{"main":[[{"node":"Discord","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]}},"source":"docs/_workflows/courses/level-one/finished.json","description":"Workflow example from docs/_workflows/courses/level-one/finished.json"}]

node_connections:
  [{"fromNode":"HTTP Request1","toNode":"If1","connectionType":"main"},{"fromNode":"If1","toNode":"Edit Fields1","connectionType":"main"},{"fromNode":"If1","toNode":"Code1","connectionType":"main"},{"fromNode":"Edit Fields1","toNode":"Airtable1","connectionType":"main"},{"fromNode":"Code1","toNode":"Discord1","connectionType":"main"},{"fromNode":"When clicking ‘Execute workflow’","toNode":"HTTP Request1","connectionType":"main"},{"fromNode":"HTTP Request","toNode":"If","connectionType":"main"},{"fromNode":"If","toNode":"Edit Fields","connectionType":"main"},{"fromNode":"If","toNode":"Code","connectionType":"main"},{"fromNode":"Edit Fields","toNode":"Airtable","connectionType":"main"},{"fromNode":"Code","toNode":"Discord","connectionType":"main"},{"fromNode":"Schedule Trigger","toNode":"HTTP Request","connectionType":"main"}]

example_workflow:
  {"name":"Discord Example Workflow","nodes":[{"parameters":{"webhookUri":"example-value","text":"example-value","options":{}},"id":"1ppktkjfxzy1oxzqx1o6h5","name":"Discord","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Webhook URL","name":"webhookUri","type":"string","default":"","required":true,"placeholder":"https://discord.com/api/webhooks/ID/TOKEN"},{"displayName":"Content","name":"text","type":"string","default":"","placeholder":"Hello World!"},{"displayName":"Additional Fields","name":"options","type":"collection","default":"{","description":"Whether this message be sent as a Text To Speech message","placeholder":"Add Option"}]


node_type: n8n-nodes-base.EditImage
name: EditImage
display_name: Background Color
description: Adds a blur to the image and so makes it less sharp
category: transform
icon: fa:image
code_hash: 091299be6339bea30743c8263f8773f388c8c9ce936efa20be50765b608a38c7
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.EditImage
documentation_title: Edit Image
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"edit-image","description":"Templates for edit-image"}]
related_resources: []
required_scopes: []
parameter_schemas: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.EditImage = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const gm_1 = __importDefault(require("gm"));
  const tmp_promise_1 = require("tmp-promise");
  const path_1 = require("path");
  const fs_1 = require("fs");
  const util_1 = require("util");
  const fsWriteFileAsync = (0, util_1.promisify)(fs_1.writeFile);
  const get_system_fonts_1 = __importDefault(require("get-system-fonts"));
  const nodeOperations = [
      {
          name: 'Blur',
          value: 'blur',
          description: 'Adds a blur to the image and so makes it less sharp',
          action: 'Blur Image',
      },
      {
          name: 'Border',
          value: 'border',
          description: 'Adds a border to the image',
          action: 'Border Image',
      },
      {
          name: 'Composite',
          value: 'composite',
          description: 'Composite image on top of another one',
          action: 'Composite Image',
      },
      {
          name: 'Create',
          value: 'create',
          description: 'Create a new image',
          action: 'Create Image',
      },
      {
          name: 'Crop',
          value: 'crop',
          description: 'Crops the image',
          action: 'Crop Image',
      },
      {
          name: 'Draw',
          value: 'draw',
          description: 'Draw on image',
          action: 'Draw Image',
      },
      {
          name: 'Rotate',
          value: 'rotate',
          description: 'Rotate image',
          action: 'Rotate Image',
      },
      {
          name: 'Resize',
          value: 'resize',
          description: 'Change the size of image',
          action: 'Resize Image',
      },
      {
          name: 'Shear',
          value: 'shear',
          description: 'Shear image along the X or Y axis',
          action: 'Shear Image',
      },
      {
          name: 'Text',
          value: 'text',
          description: 'Adds text to image',
          action: 'Apply Text to Image',
      },
      {
          name: 'Transparent',
          value: 'transparent',
          description: 'Make a color in image transparent',
          action: 'Add Transparency to Image',
      },
  ];
  const nodeOperationOptions = [
      {
          displayName: 'Background Color',
          name: 'backgroundColor',
          type: 'color',
          default: '#ffffff00',
          typeOptions: {
              showAlpha: true,
          },
          displayOptions: {
              show: {
                  operation: ['create'],
              },
          },
          description: 'The background color of the image to create',
      },
      {
          displayName: 'Image Width',
          name: 'width',
          type: 'number',
          default: 50,
          typeOptions: {
              minValue: 1,
          },
          displayOptions: {
              show: {
                  operation: ['create'],
              },
          },
          description: 'The width of the image to create',
      },
      {
          displayName: 'Image Height',
          name: 'height',
          type: 'number',
          default: 50,
          typeOptions: {
              minValue: 1,
          },
          displayOptions: {
              show: {
                  operation: ['create'],
              },
          },
          description: 'The height of the image to create',
      },
      {
          displayName: 'Primitive',
          name: 'primitive',
          type: 'options',
          displayOptions: {
              show: {
                  operation: ['draw'],
              },
          },
          options: [
              {
                  name: 'Circle',
                  value: 'circle',
              },
              {
                  name: 'Line',
                  value: 'line',
              },
              {
                  name: 'Rectangle',
                  value: 'rectangle',
              },
          ],
          default: 'rectangle',
          description: 'The primitive to draw',
      },
      {
          displayName: 'Color',
          name: 'color',
          type: 'color',
          default: '#ff000000',
          typeOptions: {
              showAlpha: true,
          },
          displayOptions: {
              show: {
                  operation: ['draw'],
              },
          },
          description: 'The color of the primitive to draw',
      },
      {
          displayName: 'Start Position X',
          name: 'startPositionX',
          type: 'number',
          default: 50,
          displayOptions: {
              show: {
                  operation: ['draw'],
                  primitive: ['circle', 'line', 'rectangle'],
              },
          },
          description: 'X (horizontal) start position of the primitive',
      },
      {
          displayName: 'Start Position Y',
          name: 'startPositionY',
          type: 'number',
          default: 50,
          displayOptions: {
              show: {
                  operation: ['draw'],
                  primitive: ['circle', 'line', 'rectangle'],
              },
          },
          description: 'Y (horizontal) start position of the primitive',
      },
      {
          displayName: 'End Position X',
          name: 'endPositionX',
          type: 'number',
          default: 250,
          displayOptions: {
              show: {
                  operation: ['draw'],
                  primitive: ['circle', 'line', 'rectangle'],
              },
          },
          description: 'X (horizontal) end position of the primitive',
      },
      {
          displayName: 'End Position Y',
          name: 'endPositionY',
          type: 'number',
          default: 250,
          displayOptions: {
              show: {
                  operation: ['draw'],
                  primitive: ['circle', 'line', 'rectangle'],
              },
          },
          description: 'Y (horizontal) end position of the primitive',
      },
      {
          displayName: 'Corner Radius',
          name: 'cornerRadius',
          type: 'number',
          default: 0,
          displayOptions: {
              show: {
                  operation: ['draw'],
                  primitive: ['rectangle'],
              },
          },
          description: 'The radius of the corner to create round corners',
      },
      {
          displayName: 'Text',
          name: 'text',
          typeOptions: {
              rows: 5,
          },
          type: 'string',
          default: '',
          placeholder: 'Text to render',
          displayOptions: {
              show: {
                  operation: ['text'],
              },
          },
          description: 'Text to write on the image',
      },
      {
          displayName: 'Font Size',
          name: 'fontSize',
          type: 'number',
          default: 18,
          displayOptions: {
              show: {
                  operation: ['text'],
              },
          },
          description: 'Size of the text',
      },
      {
          displayName: 'Font Color',
          name: 'fontColor',
          type: 'color',
          default: '#000000',
          displayOptions: {
              show: {
                  operation: ['text'],
              },
          },
          description: 'Color of the text',
      },
      {
          displayName: 'Position X',
          name: 'positionX',
          type: 'number',
          default: 50,
          displayOptions: {
              show: {
                  operation: ['text'],
              },
          },
          description: 'X (horizontal) position of the text',
      },
      {
          displayName: 'Position Y',
          name: 'positionY',
          type: 'number',
          default: 50,
          displayOptions: {
              show: {
                  operation: ['text'],
              },
          },
          description: 'Y (vertical) position of the text',
      },
      {
          displayName: 'Max Line Length',
          name: 'lineLength',
          type: 'number',
          typeOptions: {
              minValue: 1,
          },
          default: 80,
          displayOptions: {
              show: {
                  operation: ['text'],
              },
          },
          description: 'Max amount of characters in a line before a line-break should get added',
      },
      {
          displayName: 'Blur',
          name: 'blur',
          type: 'number',
          typeOptions: {
              minValue: 0,
              maxValue: 1000,
          },
          default: 5,
          displayOptions: {
              show: {
                  operation: ['blur'],
              },
          },
          description: 'How strong the blur should be',
      },
      {
          displayName: 'Sigma',
          name: 'sigma',
          type: 'number',
          typeOptions: {
              minValue: 0,
              maxValue: 1000,
          },
          default: 2,
          displayOptions: {
              show: {
                  operation: ['blur'],
              },
          },
          description: 'The sigma of the blur',
      },
      {
          displayName: 'Border Width',
          name: 'borderWidth',
          type: 'number',
          default: 10,
          displayOptions: {
              show: {
                  operation: ['border'],
              },
          },
          description: 'The width of the border',
      },
      {
          displayName: 'Border Height',
          name: 'borderHeight',
          type: 'number',
          default: 10,
          displayOptions: {
              show: {
                  operation: ['border'],
              },
          },
          description: 'The height of the border',
      },
      {
          displayName: 'Border Color',
          name: 'borderColor',
          type: 'color',
          default: '#000000',
          displayOptions: {
              show: {
                  operation: ['border'],
              },
          },
          description: 'Color of the border',
      },
      {
          displayName: 'Composite Image Property',
          name: 'dataPropertyNameComposite',
          type: 'string',
          default: '',
          placeholder: 'data2',
          displayOptions: {
              show: {
                  operation: ['composite'],
              },
          },
          description: 'The name of the binary property which contains the data of the image to composite on top of image which is found in Property Name',
      },
      {
          displayName: 'Operator',
          name: 'operator',
          type: 'options',
          displayOptions: {
              show: {
                  operation: ['composite'],
              },
          },
          options: [
              {
                  name: 'Add',
                  value: 'Add',
              },
              {
                  name: 'Atop',
                  value: 'Atop',
              },
              {
                  name: 'Bumpmap',
                  value: 'Bumpmap',
              },
              {
                  name: 'Copy',
                  value: 'Copy',
              },
              {
                  name: 'Copy Black',
                  value: 'CopyBlack',
              },
              {
                  name: 'Copy Blue',
                  value: 'CopyBlue',
              },
              {
                  name: 'Copy Cyan',
                  value: 'CopyCyan',
              },
              {
                  name: 'Copy Green',
                  value: 'CopyGreen',
              },
              {
                  name: 'Copy Magenta',
                  value: 'CopyMagenta',
              },
              {
                  name: 'Copy Opacity',
                  value: 'CopyOpacity',
              },
              {
                  name: 'Copy Red',
                  value: 'CopyRed',
              },
              {
                  name: 'Copy Yellow',
                  value: 'CopyYellow',
              },
              {
                  name: 'Difference',
                  value: 'Difference',
              },
              {
                  name: 'Divide',
                  value: 'Divide',
              },
              {
                  name: 'In',
                  value: 'In',
              },
              {
                  name: 'Minus',
                  value: 'Minus',
              },
              {
                  name: 'Multiply',
                  value: 'Multiply',
              },
              {
                  name: 'Out',
                  value: 'Out',
              },
              {
                  name: 'Over',
                  value: 'Over',
              },
              {
                  name: 'Plus',
                  value: 'Plus',
              },
              {
                  name: 'Subtract',
                  value: 'Subtract',
              },
              {
                  name: 'Xor',
                  value: 'Xor',
              },
          ],
          default: 'Over',
          description: 'The operator to use to combine the images',
      },
      {
          displayName: 'Position X',
          name: 'positionX',
          type: 'number',
          default: 0,
          displayOptions: {
              show: {
                  operation: ['composite'],
              },
          },
          description: 'X (horizontal) position of composite image',
      },
      {
          displayName: 'Position Y',
          name: 'positionY',
          type: 'number',
          default: 0,
          displayOptions: {
              show: {
                  operation: ['composite'],
              },
          },
          description: 'Y (vertical) position of composite image',
      },
      {
          displayName: 'Width',
          name: 'width',
          type: 'number',
          default: 500,
          displayOptions: {
              show: {
                  operation: ['crop'],
              },
          },
          description: 'Crop width',
      },
      {
          displayName: 'Height',
          name: 'height',
          type: 'number',
          default: 500,
          displayOptions: {
              show: {
                  operation: ['crop'],
              },
          },
          description: 'Crop height',
      },
      {
          displayName: 'Position X',
          name: 'positionX',
          type: 'number',
          default: 0,
          displayOptions: {
              show: {
                  operation: ['crop'],
              },
          },
          description: 'X (horizontal) position to crop from',
      },
      {
          displayName: 'Position Y',
          name: 'positionY',
          type: 'number',
          default: 0,
          displayOptions: {
              show: {
                  operation: ['crop'],
              },
          },
          description: 'Y (vertical) position to crop from',
      },
      {
          displayName: 'Width',
          name: 'width',
          type: 'number',
          default: 500,
          displayOptions: {
              show: {
                  operation: ['resize'],
              },
          },
          description: 'New width of the image',
      },
      {
          displayName: 'Height',
          name: 'height',
          type: 'number',
          default: 500,
          displayOptions: {
              show: {
                  operation: ['resize'],
              },
          },
          description: 'New height of the image',
      },
      {
          displayName: 'Option',
          name: 'resizeOption',
          type: 'options',
          options: [
              {
                  name: 'Ignore Aspect Ratio',
                  value: 'ignoreAspectRatio',
                  description: 'Ignore aspect ratio and resize exactly to specified values',
              },
              {
                  name: 'Maximum Area',
                  value: 'maximumArea',
                  description: 'Specified values are maximum area',
              },
              {
                  name: 'Minimum Area',
                  value: 'minimumArea',
                  description: 'Specified values are minimum area',
              },
              {
                  name: 'Only if Larger',
                  value: 'onlyIfLarger',
                  description: 'Resize only if image is larger than width or height',
              },
              {
                  name: 'Only if Smaller',
                  value: 'onlyIfSmaller',
                  description: 'Resize only if image is smaller than width or height',
              },
              {
                  name: 'Percent',
                  value: 'percent',
                  description: 'Width and height are specified in percents',
              },
          ],
          default: 'maximumArea',
          displayOptions: {
              show: {
                  operation: ['resize'],
              },
          },
          description: 'How to resize the image',
      },
      {
          displayName: 'Rotate',
          name: 'rotate',
          type: 'number',
          typeOptions: {
              minValue: -360,
              maxValue: 360,
          },
          default: 0,
          displayOptions: {
              show: {
                  operation: ['rotate'],
              },
          },
          description: 'How much the image should be rotated',
      },
      {
          displayName: 'Background Color',
          name: 'backgroundColor',
          type: 'color',
          default: '#ffffffff',
          typeOptions: {
              showAlpha: true,
          },
          displayOptions: {
              show: {
                  operation: ['rotate'],
              },
          },
          description: 'The color to use for the background when image gets rotated by anything which is not a multiple of 90',
      },
      {
          displayName: 'Degrees X',
          name: 'degreesX',
          type: 'number',
          default: 0,
          displayOptions: {
              show: {
                  operation: ['shear'],
              },
          },
          description: 'X (horizontal) shear degrees',
      },
      {
          displayName: 'Degrees Y',
          name: 'degreesY',
          type: 'number',
          default: 0,
          displayOptions: {
              show: {
                  operation: ['shear'],
              },
          },
          description: 'Y (vertical) shear degrees',
      },
      {
          displayName: 'Color',
          name: 'color',
          type: 'color',
          default: '#ff0000',
          displayOptions: {
              show: {
                  operation: ['transparent'],
              },
          },
          description: 'The color to make transparent',
      },
  ];
  class EditImage {
      constructor() {
          this.description = {
              displayName: 'Edit Image',
              name: 'editImage',
              icon: 'fa:image',
              group: ['transform'],
              version: 1,
              description: 'Edits an image like blur, resize or adding border and text',
              defaults: {
                  name: 'Edit Image',
                  color: '#553399',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Get Information',
                              value: 'information',
                              description: 'Returns image information like resolution',
                          },
                          {
                              name: 'Multi Step',
                              value: 'multiStep',
                              description: 'Perform multiple operations',
                          },
                          ...nodeOperations,
                      ].sort((a, b) => {
                          if (a.name.toLowerCase() < b.name.toLowerCase()) {
                              return -1;
                          }
                          if (a.name.toLowerCase() > b.name.toLowerCase()) {
                              return 1;
                          }
                          return 0;
                      }),
                      default: 'border',
                  },
                  {
                      displayName: 'Property Name',
                      name: 'dataPropertyName',
                      type: 'string',
                      default: 'data',
                      description: 'Name of the binary property in which the image data can be found',
                  },
                  {
                      displayName: 'Operations',
                      name: 'operations',
                      placeholder: 'Add Operation',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                          sortable: true,
                      },
                      displayOptions: {
                          show: {
                              operation: ['multiStep'],
                          },
                      },
                      description: 'The operations to perform',
                      default: {},
                      options: [
                          {
                              name: 'operations',
                              displayName: 'Operations',
                              values: [
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      noDataExpression: true,
                                      options: nodeOperations,
                                      default: '',
                                  },
                                  ...nodeOperationOptions,
                                  {
                                      displayName: 'Font Name or ID',
                                      name: 'font',
                                      type: 'options',
                                      displayOptions: {
                                          show: {
                                              operation: ['text'],
                                          },
                                      },
                                      typeOptions: {
                                          loadOptionsMethod: 'getFonts',
                                      },
                                      default: 'default',
                                      description: 'The font to use. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                                  },
                              ],
                          },
                      ],
                  },
                  ...nodeOperationOptions,
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          hide: {
                              operation: ['information'],
                          },
                      },
                      options: [
                          {
                              displayName: 'File Name',
                              name: 'fileName',
                              type: 'string',
                              default: '',
                              description: 'File name to set in binary data',
                          },
                          {
                              displayName: 'Font Name or ID',
                              name: 'font',
                              type: 'options',
                              displayOptions: {
                                  show: {
                                      '/operation': ['text'],
                                  },
                              },
                              typeOptions: {
                                  loadOptionsMethod: 'getFonts',
                              },
                              default: 'default',
                              description: 'The font to use. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Format',
                              name: 'format',
                              type: 'options',
                              options: [
                                  {
                                      name: 'bmp',
                                      value: 'bmp',
                                  },
                                  {
                                      name: 'gif',
                                      value: 'gif',
                                  },
                                  {
                                      name: 'jpeg',
                                      value: 'jpeg',
                                  },
                                  {
                                      name: 'png',
                                      value: 'png',
                                  },
                                  {
                                      name: 'tiff',
                                      value: 'tiff',
                                  },
                                  {
                                      name: 'WebP',
                                      value: 'webp',
                                  },
                              ],
                              default: 'jpeg',
                              description: 'Set the output image format',
                          },
                          {
                              displayName: 'Quality',
                              name: 'quality',
                              type: 'number',
                              typeOptions: {
                                  minValue: 0,
                                  maxValue: 100,
                              },
                              default: 100,
                              displayOptions: {
                                  show: {
                                      format: ['jpeg', 'png', 'tiff'],
                                  },
                              },
                              description: 'Sets the jpeg|png|tiff compression level from 0 to 100 (best)',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getFonts() {
                      const files = await (0, get_system_fonts_1.default)();
                      const returnData = [];
                      files.forEach((entry) => {
                          const pathParts = (0, path_1.parse)(entry);
                          if (!pathParts.ext) {
                              return;
                          }
                          returnData.push({
                              name: pathParts.name,
                              value: entry,
                          });
                      });
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      returnData.unshift({
                          name: 'default',
                          value: 'default',
                      });
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let item;
          for (let itemIndex = 0; itemIndex < length; itemIndex++) {
              try {
                  item = items[itemIndex];
                  const operation = this.getNodeParameter('operation', itemIndex);
                  const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex);
                  const options = this.getNodeParameter('options', itemIndex, {});
                  const cleanupFunctions = [];
                  let gmInstance;
                  const requiredOperationParameters = {
                      blur: ['blur', 'sigma'],
                      border: ['borderColor', 'borderWidth', 'borderHeight'],
                      create: ['backgroundColor', 'height', 'width'],
                      crop: ['height', 'positionX', 'positionY', 'width'],
                      composite: ['dataPropertyNameComposite', 'operator', 'positionX', 'positionY'],
                      draw: [
                          'color',
                          'cornerRadius',
                          'endPositionX',
                          'endPositionY',
                          'primitive',
                          'startPositionX',
                          'startPositionY',
                      ],
                      information: [],
                      resize: ['height', 'resizeOption', 'width'],
                      rotate: ['backgroundColor', 'rotate'],
                      shear: ['degreesX', 'degreesY'],
                      text: ['font', 'fontColor', 'fontSize', 'lineLength', 'positionX', 'positionY', 'text'],
                      transparent: ['color'],
                  };
                  let operations = [];
                  if (operation === 'multiStep') {
                      const operationsData = this.getNodeParameter('operations', itemIndex, {
                          operations: [],
                      });
                      operations = operationsData.operations;
                  }
                  else {
                      const operationParameters = {};
                      requiredOperationParameters[operation].forEach((parameterName) => {
                          try {
                              operationParameters[parameterName] = this.getNodeParameter(parameterName, itemIndex);
                          }
                          catch (error) { }
                      });
                      operations = [
                          {
                              operation,
                              ...operationParameters,
                          },
                      ];
                  }
                  if (operations[0].operation !== 'create') {
                      this.helpers.assertBinaryData(itemIndex, dataPropertyName);
                      const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, dataPropertyName);
                      gmInstance = (0, gm_1.default)(binaryDataBuffer);
                      gmInstance = gmInstance.background('transparent');
                  }
                  const newItem = {
                      json: item.json,
                      binary: {},
                      pairedItem: {
                          item: itemIndex,
                      },
                  };
                  if (operation === 'information') {
                      const imageData = await new Promise((resolve, reject) => {
                          gmInstance = gmInstance.identify((error, data) => {
                              if (error) {
                                  reject(error);
                                  return;
                              }
                              resolve(data);
                          });
                      });
                      newItem.json = imageData;
                  }
                  for (let i = 0; i < operations.length; i++) {
                      const operationData = operations[i];
                      if (operationData.operation === 'blur') {
                          gmInstance = gmInstance.blur(operationData.blur, operationData.sigma);
                      }
                      else if (operationData.operation === 'border') {
                          gmInstance = gmInstance
                              .borderColor(operationData.borderColor)
                              .border(operationData.borderWidth, operationData.borderHeight);
                      }
                      else if (operationData.operation === 'composite') {
                          const positionX = operationData.positionX;
                          const positionY = operationData.positionY;
                          const operator = operationData.operator;
                          const geometryString = (positionX >= 0 ? '+' : '') + positionX + (positionY >= 0 ? '+' : '') + positionY;
                          const binaryPropertyName = operationData.dataPropertyNameComposite;
                          this.helpers.assertBinaryData(itemIndex, binaryPropertyName);
                          const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, binaryPropertyName);
                          const { fd, path, cleanup } = await (0, tmp_promise_1.file)();
                          cleanupFunctions.push(cleanup);
                          await fsWriteFileAsync(fd, binaryDataBuffer);
                          if (operations[0].operation === 'create') {
                              gmInstance = (0, gm_1.default)(gmInstance.stream('png'))
                                  .compose(operator)
                                  .geometry(geometryString)
                                  .composite(path);
                          }
                          else {
                              gmInstance = gmInstance.compose(operator).geometry(geometryString).composite(path);
                          }
                          if (operations.length !== i + 1) {
                              gmInstance = (0, gm_1.default)(gmInstance.stream());
                          }
                      }
                      else if (operationData.operation === 'create') {
                          gmInstance = (0, gm_1.default)(operationData.width, operationData.height, operationData.backgroundColor);
                          if (!options.format) {
                              options.format = 'png';
                          }
                      }
                      else if (operationData.operation === 'crop') {
                          gmInstance = gmInstance.crop(operationData.width, operationData.height, operationData.positionX, operationData.positionY);
                      }
                      else if (operationData.operation === 'draw') {
                          gmInstance = gmInstance.fill(operationData.color);
                          if (operationData.primitive === 'line') {
                              gmInstance = gmInstance.drawLine(operationData.startPositionX, operationData.startPositionY, operationData.endPositionX, operationData.endPositionY);
                          }
                          else if (operationData.primitive === 'circle') {
                              gmInstance = gmInstance.drawCircle(operationData.startPositionX, operationData.startPositionY, operationData.endPositionX, operationData.endPositionY);
                          }
                          else if (operationData.primitive === 'rectangle') {
                              gmInstance = gmInstance.drawRectangle(operationData.startPositionX, operationData.startPositionY, operationData.endPositionX, operationData.endPositionY, operationData.cornerRadius || undefined);
                          }
                      }
                      else if (operationData.operation === 'resize') {
                          const resizeOption = operationData.resizeOption;
                          let option = '@';
                          if (resizeOption === 'ignoreAspectRatio') {
                              option = '!';
                          }
                          else if (resizeOption === 'minimumArea') {
                              option = '^';
                          }
                          else if (resizeOption === 'onlyIfSmaller') {
                              option = '<';
                          }
                          else if (resizeOption === 'onlyIfLarger') {
                              option = '>';
                          }
                          else if (resizeOption === 'percent') {
                              option = '%';
                          }
                          gmInstance = gmInstance.resize(operationData.width, operationData.height, option);
                      }
                      else if (operationData.operation === 'rotate') {
                          gmInstance = gmInstance.rotate(operationData.backgroundColor, operationData.rotate);
                      }
                      else if (operationData.operation === 'shear') {
                          gmInstance = gmInstance.shear(operationData.degreesX, operationData.degreesY);
                      }
                      else if (operationData.operation === 'text') {
                          const lines = [];
                          let currentLine = '';
                          operationData.text.split('\n').forEach((textLine) => {
                              textLine.split(' ').forEach((textPart) => {
                                  if (currentLine.length + textPart.length + 1 >
                                      operationData.lineLength) {
                                      lines.push(currentLine.trim());
                                      currentLine = `${textPart} `;
                                      return;
                                  }
                                  currentLine += `${textPart} `;
                              });
                              lines.push(currentLine.trim());
                              currentLine = '';
                          });
                          const renderText = lines.join('\n');
                          const font = options.font || operationData.font;
                          if (font && font !== 'default') {
                              gmInstance = gmInstance.font(font);
                          }
                          gmInstance = gmInstance
                              .fill(operationData.fontColor)
                              .fontSize(operationData.fontSize)
                              .drawText(operationData.positionX, operationData.positionY, renderText);
                      }
                      else if (operationData.operation === 'transparent') {
                          gmInstance = gmInstance.transparent(operationData.color);
                      }
                  }
                  if (item.binary !== undefined && newItem.binary) {
                      Object.assign(newItem.binary, item.binary);
                      if (newItem.binary[dataPropertyName]) {
                          newItem.binary[dataPropertyName] = (0, n8n_workflow_1.deepCopy)(newItem.binary[dataPropertyName]);
                      }
                  }
                  if (newItem.binary[dataPropertyName] === undefined) {
                      newItem.binary[dataPropertyName] = {
                          data: '',
                          mimeType: '',
                      };
                  }
                  if (options.quality !== undefined) {
                      gmInstance = gmInstance.quality(options.quality);
                  }
                  if (options.format !== undefined) {
                      gmInstance = gmInstance.setFormat(options.format);
                      newItem.binary[dataPropertyName].fileExtension = options.format;
                      newItem.binary[dataPropertyName].mimeType = `image/${options.format}`;
                      const fileName = newItem.binary[dataPropertyName].fileName;
                      if (fileName === null || fileName === void 0 ? void 0 : fileName.includes('.')) {
                          newItem.binary[dataPropertyName].fileName =
                              fileName.split('.').slice(0, -1).join('.') + '.' + options.format;
                      }
                  }
                  if (options.fileName !== undefined) {
                      newItem.binary[dataPropertyName].fileName = options.fileName;
                  }
                  returnData.push(await new Promise((resolve, reject) => {
                      gmInstance.toBuffer(async (error, buffer) => {
                          cleanupFunctions.forEach(async (cleanup) => cleanup());
                          if (error) {
                              return reject(error);
                          }
                          const binaryData = await this.helpers.prepareBinaryData(Buffer.from(buffer));
                          newItem.binary[dataPropertyName] = {
                              ...newItem.binary[dataPropertyName],
                              ...binaryData,
                          };
                          return resolve(newItem);
                      });
                  }));
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({
                          json: {
                              error: error.message,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.EditImage = EditImage;
  //# sourceMappingURL=EditImage.node.js.map

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

  # Edit Image

  Use the Edit Image node to manipulate and edit images.

  /// note | Dependencies
  1. If you aren't running n8n on Docker, you need to install [GraphicsMagick](http://www.graphicsmagick.org/README.html){:target=_blank .external-link}.
  2. You need to use a node such as the [Read/Write Files from Disk](/integrations/builtin/core-nodes/n8n-nodes-base.readwritefile.md) node or the [HTTP Request](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/index.md) node to pass the image file as a data property to the Edit Image node.
  ///

  ## Operations

  - Add a **Blur** to the image to reduce sharpness
  - Add a **Border** to the image
  - **Composite** an image on top of another image
  - **Create** a new image
  - **Crop** the image
  - **Draw** on an image
  - **Get Information** about the image
  - **Multi Step** perform multiple operations on the image
  - **Resize**: Change the size of the image
  - **Rotate** the image
  - **Shear** image along the X or Y axis
  - Add **Text** to the image
  - Make a color in image **Transparent**

  ## Node parameters

  The parameters for this node depend on the operation you select.

  ### Blur parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Blur**: Enter a number to set how strong the blur should be, between 0 and 1000. Higher numbers create blurrier images.
  * **Sigma**: Enter a number to set the stigma for the blur, between 0 and 1000. Higher numbers create blurrier images.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Border parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Border Width**: Enter the width of the border.
  * **Border Height**: Enter the height of the border.
  * **Border Color**: Set the color for the border. You can either enter a hex or select the color swatch to open a color picker.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Composite parameters

  * **Property Name**: Enter the name of the binary property that stores the image data. This image is your base image.
  * **Composite Image Property**: Enter the name of the binary property that stores image to composite on top of the **Property Name** image.
  * **Operator**: Select composite operator, which determines how the composite works. Options include:
  	* **Add**
  	* **Atop**
  	* **Bumpmap**
  	* **Copy**
  	* **Copy Black**
  	* **Copy Blue**
  	* **Copy Cyan**
  	* **Copy Green**
  	* **Copy Magenta**
  	* **Copy Opacity**
  	* **Copy Red**
  	* **Copy Yellow**
  	* **Difference**
  	* **Divide**
  	* **In**
  	* **Minus**
  	* **Multiply**
  	* **Out**
  	* **Over**
  	* **Plus**
  	* **Subtract**
  	* **Xor**
  * **Position X**: Enter the x axis position (horizontal) of the composite image.
  * **Position Y**: Enter the y axis position (vertical) of the composite image.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Create parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Background Color**: Set the background color for the image. You can either enter a hex or select the color swatch to open a color picker.
  * **Image Width**: Enter the width of the image.
  * **Image Height**: Enter the height of the image.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Crop parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Width**: Enter the width you'd like to crop to.
  * **Height**: Enter the height you'd like to crop to.
  * **Position X**: Enter the x axis position (horizontal) to start the crop from.
  * **Position Y**: Enter the y axis position (vertical) to start the crop from.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Draw parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Primitive**: Select the primitive shape to draw. Choose from:
  	* **Circle**
  	* **Line**
  	* **Rectangle**
  * **Color**: Set the color for the primitive. You can either enter a hex or select the color swatch to open a color picker.
  * **Start Position X**: Enter the x axis position (horizontal) to start drawing from.
  * **Start Position Y**: Enter the y axis position (vertical) to start drawing from.
  * **End Position X**: Enter the x axis position (horizontal) to stop drawing at.
  * **End Position Y**: Enter the y axis position (vertical) to start drawing at.
  * **Corner Radius**: Enter a number to set the corner radius. Adding a corner radius will round the corners of the drawn primitive.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Get Information parameters

  For this operation, you only need to add the **Property Name** of the binary property that stores the image data.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Multi Step parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Operations**: Add the operations you want the multi step operation to perform. You can use any of the other operations.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Resize parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Width**: Enter the new width you'd like for the image.
  * **Height**: Enter the new height you'd like for the image.
  * **Option**: Select how you'd like to resize the image. Choose from:
  	* **Ignore Aspect Ratio**: Ignore the aspect ratio and resize to the exact height and width you've entered.
  	* **Maximum Area**: The height and width you've entered is the maximum area/size for the image. The image maintains its aspect ratio and won't be larger than the height and/or width you've entered.
  	* **Minimum Area**: The height and width you've entered is the minimum area/size for the image. The image maintains its aspect ratio and won't be smaller than the height and/or width you've entered.
  	* **Only if Larger**: Resize the image only if it's larger than the width and height you entered. The image maintains its aspect ratio.
  	* **Only if Smaller**: Resize the image only if it's smaller than the width and height you entered. The image maintains its aspect ratio.
  	* **Percent**: Resize the image using the width and height as percentages of the original image.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Rotate parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Rotate**: Enter the number of degrees to rotate the image, from --360 to 360.
  * **Background Color**: Set the background color for the image. You can either enter a hex or select the color swatch to open a color picker. This color is used to fill in the empty background whenever the image is rotated by multiples of 90 degrees. If multipled of 90 degrees are used for the **Rotate** field, the background color isn't used.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Shear parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Degrees X**: Enter the number of degrees to shear from the x axis.
  * **Degrees Y**: Enter the number of degrees to shear from the y axis.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Text parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Text**: Enter the text you'd like to write on the image.
  * **Font Size**: Select the font size for the text.
  * **Font Color**: Set the font color. You can either enter a hex or select the color swatch to open a color picker.
  * **Position X**: Enter the x axis position (horizontal) to begin the text at.
  * **Position Y**: Enter the y axis position (vertical) to begin the text at.
  * **Max Line Length**: Enter the maximum amount of characters in a line before adding a line break.

  Refer to [Node options](#node-options) for optional configuration options.

  ### Transparent parameters

  * **Property Name**: Enter the name of the binary property that stores the image data.
  * **Color**: Set the color to make transparent. You can either enter a hex or select the color swatch to open a color picker.

  Refer to [Node options](#node-options) for optional configuration options.

  ## Node options

  - **File Name**: Enter the filename of the output file.
  - **Format**: Enter the image format of the output file. Choose from:
  	- **bmp**
  	- **gif**
  	- **jpeg**
  	- **png**
  	- **tiff**
  	- **WebP**

  The **Text** operation also includes the option for **Font Name or ID**. Select the text font from the dropdown or specify an ID using an [expression](/code/expressions.md).

  ## Templates and examples

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

troubleshooting_info:
  [{"issue":"Node parameters","solution":"The parameters for this node depend on the operation you select."},{"issue":"Blur parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Blur**: Enter a number to set how strong the blur should be, between 0 and 1000. Higher numbers create blurrier images.\n* **Sigma**: Enter a number to set the stigma for the blur, between 0 and 1000. Higher numbers create blurrier images."},{"issue":"Border parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Border Width**: Enter the width of the border.\n* **Border Height**: Enter the height of the border.\n* **Border Color**: Set the color for the border. You can either enter a hex or select the color swatch to open a color picker."},{"issue":"Composite parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data. This image is your base image.\n* **Composite Image Property**: Enter the name of the binary property that stores image to composite on top of the **Property Name** image.\n* **Operator**: Select composite operator, which determines how the composite works. Options include:\n\t* **Add**\n\t* **Atop**\n\t* **Bumpmap**\n\t* **Copy**\n\t* **Copy Black**\n\t* **Copy Blue**\n\t* **Copy Cyan**\n\t* **Copy Green**\n\t* **Copy Magenta**\n\t* **Copy Opacity**\n\t* **Copy Red**\n\t* **Copy Yellow**\n\t* **Difference**\n\t* **Divide**\n\t* **In**\n\t* **Minus**\n\t* **Multiply**\n\t* **Out**\n\t* **Over**\n\t* **Plus**\n\t* **Subtract**\n\t* **Xor**\n* **Position X**: Enter the x axis position (horizontal) of the composite image.\n* **Position Y**: Enter the y axis position (vertical) of the composite image."},{"issue":"Create parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Background Color**: Set the background color for the image. You can either enter a hex or select the color swatch to open a color picker.\n* **Image Width**: Enter the width of the image.\n* **Image Height**: Enter the height of the image."},{"issue":"Crop parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Width**: Enter the width you'd like to crop to.\n* **Height**: Enter the height you'd like to crop to.\n* **Position X**: Enter the x axis position (horizontal) to start the crop from.\n* **Position Y**: Enter the y axis position (vertical) to start the crop from."},{"issue":"Draw parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Primitive**: Select the primitive shape to draw. Choose from:\n\t* **Circle**\n\t* **Line**\n\t* **Rectangle**\n* **Color**: Set the color for the primitive. You can either enter a hex or select the color swatch to open a color picker.\n* **Start Position X**: Enter the x axis position (horizontal) to start drawing from.\n* **Start Position Y**: Enter the y axis position (vertical) to start drawing from.\n* **End Position X**: Enter the x axis position (horizontal) to stop drawing at.\n* **End Position Y**: Enter the y axis position (vertical) to start drawing at.\n* **Corner Radius**: Enter a number to set the corner radius. Adding a corner radius will round the corners of the drawn primitive."},{"issue":"Get Information parameters","solution":"For this operation, you only need to add the **Property Name** of the binary property that stores the image data."},{"issue":"Multi Step parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Operations**: Add the operations you want the multi step operation to perform. You can use any of the other operations."},{"issue":"Resize parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Width**: Enter the new width you'd like for the image.\n* **Height**: Enter the new height you'd like for the image.\n* **Option**: Select how you'd like to resize the image. Choose from:\n\t* **Ignore Aspect Ratio**: Ignore the aspect ratio and resize to the exact height and width you've entered.\n\t* **Maximum Area**: The height and width you've entered is the maximum area/size for the image. The image maintains its aspect ratio and won't be larger than the height and/or width you've entered.\n\t* **Minimum Area**: The height and width you've entered is the minimum area/size for the image. The image maintains its aspect ratio and won't be smaller than the height and/or width you've entered.\n\t* **Only if Larger**: Resize the image only if it's larger than the width and height you entered. The image maintains its aspect ratio.\n\t* **Only if Smaller**: Resize the image only if it's smaller than the width and height you entered. The image maintains its aspect ratio.\n\t* **Percent**: Resize the image using the width and height as percentages of the original image."},{"issue":"Rotate parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Rotate**: Enter the number of degrees to rotate the image, from --360 to 360.\n* **Background Color**: Set the background color for the image. You can either enter a hex or select the color swatch to open a color picker. This color is used to fill in the empty background whenever the image is rotated by multiples of 90 degrees. If multipled of 90 degrees are used for the **Rotate** field, the background color isn't used."},{"issue":"Shear parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Degrees X**: Enter the number of degrees to shear from the x axis.\n* **Degrees Y**: Enter the number of degrees to shear from the y axis."},{"issue":"Text parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Text**: Enter the text you'd like to write on the image.\n* **Font Size**: Select the font size for the text.\n* **Font Color**: Set the font color. You can either enter a hex or select the color swatch to open a color picker.\n* **Position X**: Enter the x axis position (horizontal) to begin the text at.\n* **Position Y**: Enter the y axis position (vertical) to begin the text at.\n* **Max Line Length**: Enter the maximum amount of characters in a line before adding a line break."},{"issue":"Transparent parameters","solution":"* **Property Name**: Enter the name of the binary property that stores the image data.\n* **Color**: Set the color to make transparent. You can either enter a hex or select the color swatch to open a color picker."},{"issue":"Node options","solution":"- **File Name**: Enter the filename of the output file.\n- **Format**: Enter the image format of the output file. Choose from:\n\t- **bmp**\n\t- **gif**\n\t- **jpeg**\n\t- **png**\n\t- **tiff**\n\t- **WebP**"}]

example_workflow:
  {"name":"Background Color Example Workflow","nodes":[{"parameters":{"operation":"information","dataPropertyName":"Example Name","operations":{},"dynamic_property":null,"options":{}},"id":"9y5jkuc47g55g3kj0grk5","name":"Background Color","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

example_parameters:
  {"operation":"information","dataPropertyName":"Example Name","operations":{},"dynamic_property":null,"options":{}}

properties_schema:
  [{"displayName":"Operation","name":"operation","type":"options","default":"border","description":"Returns image information like resolution","options":[{"name":"Get Information","value":"information","description":"Returns image information like resolution"},{"name":"Multi Step","value":"multiStep","description":"Perform multiple operations"}]},{"displayName":"Property Name","name":"dataPropertyName","type":"string","default":"data","description":"Name of the binary property in which the image data can be found"},{"displayName":"Operations","name":"operations","type":"fixedCollection","default":"{","description":"The operations to perform","placeholder":"Add Operation"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...nodeOperationOptions"},{"displayName":"Options","name":"options","type":"collection","default":"{","description":"File name to set in binary data","placeholder":"Add Option"}]


node_type: n8n-nodes-base.E2eTest
name: E2eTest
display_name: E2E Test
description: Dummy node used for e2e testing
category: output
icon: fa:play
code_hash: 2bdc344d2866f7e3a961538270c732f5f44ed4b8e88d8287b757f159df2aac08
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.E2eTest = void 0;
  const mock_1 = require("./mock");
  class E2eTest {
      constructor() {
          this.description = {
              displayName: 'E2E Test',
              name: 'e2eTest',
              icon: 'fa:play',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"]}}',
              description: 'Dummy node used for e2e testing',
              defaults: {
                  name: 'E2E Test',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Remote Options',
                              value: 'remoteOptions',
                          },
                          {
                              name: 'Resource Locator',
                              value: 'resourceLocator',
                          },
                          {
                              name: 'Resource Mapping Component',
                              value: 'resourceMapper',
                          },
                      ],
                      default: 'remoteOptions',
                  },
                  {
                      displayName: 'Field ID',
                      name: 'fieldId',
                      type: 'string',
                      default: '',
                  },
                  {
                      displayName: 'Remote Options Name or ID',
                      name: 'remoteOptions',
                      description: 'Remote options to load. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                      type: 'options',
                      typeOptions: {
                          loadOptionsDependsOn: ['fieldId'],
                          loadOptionsMethod: 'getOptions',
                      },
                      required: true,
                      default: [],
                      displayOptions: {
                          show: {
                              operation: ['remoteOptions'],
                          },
                      },
                  },
                  {
                      displayName: 'Resource Locator',
                      name: 'rlc',
                      type: 'resourceLocator',
                      default: { mode: 'list', value: '' },
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['resourceLocator'],
                          },
                      },
                      modes: [
                          {
                              displayName: 'From List',
                              name: 'list',
                              type: 'list',
                              typeOptions: {
                                  searchListMethod: 'optionsSearch',
                                  searchable: true,
                              },
                          },
                          {
                              displayName: 'By URL',
                              name: 'url',
                              type: 'string',
                              placeholder: 'https://example.com/user/a4071e98-7d40-41fb-8911-ce3e7bf94fb2',
                              validation: [
                                  {
                                      type: 'regex',
                                      properties: {
                                          regex: 'https://example.com/user/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',
                                          errorMessage: 'Not a valid example URL',
                                      },
                                  },
                              ],
                              extractValue: {
                                  type: 'regex',
                                  regex: 'https://example.com/user/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})',
                              },
                          },
                          {
                              displayName: 'ID',
                              name: 'id',
                              type: 'string',
                              validation: [
                                  {
                                      type: 'regex',
                                      properties: {
                                          regex: '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',
                                          errorMessage: 'Not a valid UUI',
                                      },
                                  },
                              ],
                              placeholder: 'a4071e98-7d40-41fb-8911-ce3e7bf94fb2',
                          },
                      ],
                  },
                  {
                      displayName: 'Resource Mapping Component',
                      name: 'resourceMapper',
                      type: 'resourceMapper',
                      noDataExpression: true,
                      default: {
                          mappingMode: 'defineBelow',
                          value: null,
                      },
                      required: true,
                      typeOptions: {
                          loadOptionsDependsOn: ['fieldId'],
                          resourceMapper: {
                              resourceMapperMethod: 'getMappingColumns',
                              mode: 'upsert',
                              fieldWords: {
                                  singular: 'column',
                                  plural: 'columns',
                              },
                              addAllFields: true,
                              multiKeyMatch: false,
                          },
                      },
                      displayOptions: {
                          show: {
                              operation: ['resourceMapper'],
                          },
                      },
                  },
                  {
                      displayName: 'Other Non Important Field',
                      name: 'otherField',
                      type: 'string',
                      default: '',
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getOptions() {
                      return mock_1.remoteOptions;
                  },
              },
              listSearch: {
                  async optionsSearch(filter, paginationToken) {
                      const pageSize = 5;
                      let results = mock_1.searchOptions;
                      if (filter) {
                          results = results.filter((option) => option.name.includes(filter));
                      }
                      const offset = paginationToken ? parseInt(paginationToken, 10) : 0;
                      results = results.slice(offset, offset + pageSize);
                      return {
                          results,
                          paginationToken: offset + pageSize,
                      };
                  },
              },
              resourceMapping: {
                  async getMappingColumns() {
                      return mock_1.resourceMapperFields;
                  },
              },
          };
      }
      async execute() {
          const operation = this.getNodeParameter('operation', 0);
          if (operation === 'resourceMapper') {
              const rmValue = this.getNodeParameter('resourceMapper.value', 0);
              if (rmValue) {
                  return [[{ json: rmValue }]];
              }
          }
          return [mock_1.returnData];
      }
  }
  exports.E2eTest = E2eTest;
  //# sourceMappingURL=E2eTest.node.js.map

example_workflow:
  {"name":"E2E Test Example Workflow","nodes":[{"parameters":{"operation":"remoteOptions","fieldId":"example-value","remoteOptions":"[]","rlc":"{ mode: 'list'","resourceMapper":"{\n                        mappingMode: 'defineBelow'","otherField":"example-value"},"id":"2lvgph9xj4wsbinuuknj2","name":"E2E Test","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

example_parameters:
  {"operation":"remoteOptions","fieldId":"example-value","remoteOptions":"[]","rlc":"{ mode: 'list'","resourceMapper":"{\n                        mappingMode: 'defineBelow'","otherField":"example-value"}

properties_schema:
  [{"displayName":"Operation","name":"operation","type":"options","default":"remoteOptions","options":[{"name":"Remote Options","value":"remoteOptions"},{"name":"Resource Locator","value":"resourceLocator"},{"name":"Resource Mapping Component","value":"resourceMapper"}]},{"displayName":"Field ID","name":"fieldId","type":"string","default":""},{"displayName":"Remote Options Name or ID","name":"remoteOptions","type":"options","default":"[]","required":true,"description":"Remote options to load. Choose from the list, or specify an ID using an <a href="},{"displayName":"Resource Locator","name":"rlc","type":"resourceLocator","default":"{ mode: 'list'","required":true,"placeholder":"https://example.com/user/a4071e98-7d40-41fb-8911-ce3e7bf94fb2"},{"displayName":"Resource Mapping Component","name":"resourceMapper","type":"resourceMapper","default":"{\n                        mappingMode: 'defineBelow'","required":true},{"displayName":"Other Non Important Field","name":"otherField","type":"string","default":""}]


node_type: n8n-nodes-base.ERPNext
name: ERPNext
display_name: ERPNext
description: Consume ERPNext API
category: output
icon: file:erpnext.svg
code_hash: 29efdfa1b7a2885ae746d55c9bf1487a1cb4ad084e0eae6cb82e06adccb14e19
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.ERPNext
documentation_title: ERPNext node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"erpnext","description":"Templates for erpnext"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"document","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ERPNext = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const DocumentDescription_1 = require("./DocumentDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const utils_1 = require("./utils");
  class ERPNext {
      constructor() {
          this.description = {
              displayName: 'ERPNext',
              name: 'erpNext',
              icon: 'file:erpnext.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              description: 'Consume ERPNext API',
              defaults: {
                  name: 'ERPNext',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'erpNextApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Document',
                              value: 'document',
                          },
                      ],
                      default: 'document',
                  },
                  ...DocumentDescription_1.documentOperations,
                  ...DocumentDescription_1.documentFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getDocTypes() {
                      const data = await GenericFunctions_1.erpNextApiRequestAllItems.call(this, 'data', 'GET', '/api/resource/DocType', {});
                      const docTypes = data.map(({ name }) => {
                          return { name, value: encodeURI(name) };
                      });
                      return (0, utils_1.processNames)(docTypes);
                  },
                  async getDocFilters() {
                      const docType = this.getCurrentNodeParameter('docType');
                      const { data } = await GenericFunctions_1.erpNextApiRequest.call(this, 'GET', `/api/resource/DocType/${docType}`, {});
                      const docFields = data.fields.map(({ label, fieldname }) => {
                          return { name: label, value: fieldname };
                      });
                      docFields.unshift({ name: '*', value: '*' });
                      return (0, utils_1.processNames)(docFields);
                  },
                  async getDocFields() {
                      const docType = this.getCurrentNodeParameter('docType');
                      const { data } = await GenericFunctions_1.erpNextApiRequest.call(this, 'GET', `/api/resource/DocType/${docType}`, {});
                      const docFields = data.fields.map(({ label, fieldname }) => {
                          return { name: label, value: fieldname };
                      });
                      return (0, utils_1.processNames)(docFields);
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const body = {};
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              if (resource === 'document') {
                  if (operation === 'get') {
                      const docType = this.getNodeParameter('docType', i);
                      const documentName = this.getNodeParameter('documentName', i);
                      responseData = await GenericFunctions_1.erpNextApiRequest.call(this, 'GET', `/api/resource/${docType}/${documentName}`);
                      responseData = responseData.data;
                  }
                  if (operation === 'getAll') {
                      const docType = this.getNodeParameter('docType', i);
                      const endpoint = `/api/resource/${docType}`;
                      const { fields, filters } = this.getNodeParameter('options', i);
                      if (fields) {
                          if (fields.includes('*')) {
                              qs.fields = JSON.stringify(['*']);
                          }
                          else {
                              qs.fields = JSON.stringify(fields);
                          }
                      }
                      if (filters) {
                          qs.filters = JSON.stringify(filters.customProperty.map((filter) => {
                              return [docType, filter.field, (0, utils_1.toSQL)(filter.operator), filter.value];
                          }));
                      }
                      const returnAll = this.getNodeParameter('returnAll', i);
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          qs.limit_page_length = limit;
                          qs.limit_start = 0;
                          responseData = await GenericFunctions_1.erpNextApiRequest.call(this, 'GET', endpoint, {}, qs);
                          responseData = responseData.data;
                      }
                      else {
                          responseData = await GenericFunctions_1.erpNextApiRequestAllItems.call(this, 'data', 'GET', endpoint, {}, qs);
                      }
                  }
                  else if (operation === 'create') {
                      const properties = this.getNodeParameter('properties', i);
                      if (!properties.customProperty.length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter at least one property for the document to create.', { itemIndex: i });
                      }
                      properties.customProperty.forEach((property) => {
                          body[property.field] = property.value;
                      });
                      const docType = this.getNodeParameter('docType', i);
                      responseData = await GenericFunctions_1.erpNextApiRequest.call(this, 'POST', `/api/resource/${docType}`, body);
                      responseData = responseData.data;
                  }
                  else if (operation === 'delete') {
                      const docType = this.getNodeParameter('docType', i);
                      const documentName = this.getNodeParameter('documentName', i);
                      responseData = await GenericFunctions_1.erpNextApiRequest.call(this, 'DELETE', `/api/resource/${docType}/${documentName}`);
                  }
                  else if (operation === 'update') {
                      const properties = this.getNodeParameter('properties', i);
                      if (!properties.customProperty.length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter at least one property for the document to update.', { itemIndex: i });
                      }
                      properties.customProperty.forEach((property) => {
                          body[property.field] = property.value;
                      });
                      const docType = this.getNodeParameter('docType', i);
                      const documentName = this.getNodeParameter('documentName', i);
                      responseData = await GenericFunctions_1.erpNextApiRequest.call(this, 'PUT', `/api/resource/${docType}/${documentName}`, body);
                      responseData = responseData.data;
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.ERPNext = ERPNext;
  //# sourceMappingURL=ERPNext.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ERPNextApi = void 0;
  class ERPNextApi {
      constructor() {
          this.name = 'erpNextApi';
          this.displayName = 'ERPNext API';
          this.documentationUrl = 'erpnext';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'API Secret',
                  name: 'apiSecret',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'Environment',
                  name: 'environment',
                  type: 'options',
                  default: 'cloudHosted',
                  options: [
                      {
                          name: 'Cloud-Hosted',
                          value: 'cloudHosted',
                      },
                      {
                          name: 'Self-Hosted',
                          value: 'selfHosted',
                      },
                  ],
              },
              {
                  displayName: 'Subdomain',
                  name: 'subdomain',
                  type: 'string',
                  default: '',
                  placeholder: 'n8n',
                  description: 'Subdomain of cloud-hosted ERPNext instance. For example, "n8n" is the subdomain in: <code>https://n8n.erpnext.com</code>',
                  displayOptions: {
                      show: {
                          environment: ['cloudHosted'],
                      },
                  },
              },
              {
                  displayName: 'Domain',
                  name: 'domain',
                  type: 'options',
                  default: 'erpnext.com',
                  options: [
                      {
                          name: 'erpnext.com',
                          value: 'erpnext.com',
                      },
                      {
                          name: 'frappe.cloud',
                          value: 'frappe.cloud',
                      },
                  ],
                  description: 'Domain for your cloud hosted ERPNext instance.',
                  displayOptions: {
                      show: {
                          environment: ['cloudHosted'],
                      },
                  },
              },
              {
                  displayName: 'Domain',
                  name: 'domain',
                  type: 'string',
                  default: '',
                  placeholder: 'https://www.mydomain.com',
                  description: 'Fully qualified domain name of self-hosted ERPNext instance',
                  displayOptions: {
                      show: {
                          environment: ['selfHosted'],
                      },
                  },
              },
              {
                  displayName: 'Ignore SSL Issues',
                  name: 'allowUnauthorizedCerts',
                  type: 'boolean',
                  description: 'Whether to connect even if SSL certificate validation is not possible',
                  default: false,
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      Authorization: '=token {{$credentials.apiKey}}:{{$credentials.apiSecret}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.environment === "cloudHosted" ? "https://" + $credentials.subdomain + "." + $credentials.domain : $credentials.domain}}',
                  url: '/api/method/frappe.auth.get_logged_user',
                  skipSslCertificateValidation: '={{ $credentials.allowUnauthorizedCerts }}',
              },
              rules: [
                  {
                      type: 'responseSuccessBody',
                      properties: {
                          key: 'message',
                          value: undefined,
                          message: 'Unable to authenticate, Check the credentials and the url',
                      },
                  },
              ],
          };
      }
  }
  exports.ERPNextApi = ERPNextApi;
  //# sourceMappingURL=ERPNextApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ERPNextApi = void 0;
  class ERPNextApi {
      constructor() {
          this.name = 'erpNextApi';
          this.displayName = 'ERPNext API';
          this.documentationUrl = 'erpnext';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'API Secret',
                  name: 'apiSecret',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'Environment',
                  name: 'environment',
                  type: 'options',
                  default: 'cloudHosted',
                  options: [
                      {
                          name: 'Cloud-Hosted',
                          value: 'cloudHosted',
                      },
                      {
                          name: 'Self-Hosted',
                          value: 'selfHosted',
                      },
                  ],
              },
              {
                  displayName: 'Subdomain',
                  name: 'subdomain',
                  type: 'string',
                  default: '',
                  placeholder: 'n8n',
                  description: 'Subdomain of cloud-hosted ERPNext instance. For example, "n8n" is the subdomain in: <code>https://n8n.erpnext.com</code>',
                  displayOptions: {
                      show: {
                          environment: ['cloudHosted'],
                      },
                  },
              },
              {
                  displayName: 'Domain',
                  name: 'domain',
                  type: 'options',
                  default: 'erpnext.com',
                  options: [
                      {
                          name: 'erpnext.com',
                          value: 'erpnext.com',
                      },
                      {
                          name: 'frappe.cloud',
                          value: 'frappe.cloud',
                      },
                  ],
                  description: 'Domain for your cloud hosted ERPNext instance.',
                  displayOptions: {
                      show: {
                          environment: ['cloudHosted'],
                      },
                  },
              },
              {
                  displayName: 'Domain',
                  name: 'domain',
                  type: 'string',
                  default: '',
                  placeholder: 'https://www.mydomain.com',
                  description: 'Fully qualified domain name of self-hosted ERPNext instance',
                  displayOptions: {
                      show: {
                          environment: ['selfHosted'],
                      },
                  },
              },
              {
                  displayName: 'Ignore SSL Issues',
                  name: 'allowUnauthorizedCerts',
                  type: 'boolean',
                  description: 'Whether to connect even if SSL certificate validation is not possible',
                  default: false,
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      Authorization: '=token {{$credentials.apiKey}}:{{$credentials.apiSecret}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.environment === "cloudHosted" ? "https://" + $credentials.subdomain + "." + $credentials.domain : $credentials.domain}}',
                  url: '/api/method/frappe.auth.get_logged_user',
                  skipSslCertificateValidation: '={{ $credentials.allowUnauthorizedCerts }}',
              },
              rules: [
                  {
                      type: 'responseSuccessBody',
                      properties: {
                          key: 'message',
                          value: undefined,
                          message: 'Unable to authenticate, Check the credentials and the url',
                      },
                  },
              ],
          };
      }
  }
  exports.ERPNextApi = ERPNextApi;
  //# sourceMappingURL=ERPNextApi.credentials.js.map

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

  # ERPNext node

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

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

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

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

  ## Operations

  **Document**
  - Create a document
  - Delete a document
  - Retrieve a document
  - Retrieve all documents
  - Update a document

  ## Templates and examples

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

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

example_workflow:
  {"name":"ERPNext Example Workflow","nodes":[{"parameters":{"resource":"document","dynamic_property":null},"id":"czry2furxfnsizqnql6n4","name":"ERPNext","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"document","options":[{"name":"Document","value":"document"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...DocumentDescription_1.documentOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...DocumentDescription_1.documentFields"}]


node_type: n8n-nodes-base.Dropbox
name: Dropbox
display_name: Dropbox
description: Access data on Dropbox
category: input
icon: file:dropbox.svg
code_hash: 2c1ed766c39f4be2f863f96b50ead7190d2e4a9f8197ac574ea1410e58165ea2
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Dropbox
documentation_title: Dropbox node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"dropbox","description":"Templates for dropbox"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Dropbox = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  class Dropbox {
      constructor() {
          this.description = {
              displayName: 'Dropbox',
              name: 'dropbox',
              icon: 'file:dropbox.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Access data on Dropbox',
              defaults: {
                  name: 'Dropbox',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'dropboxApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['accessToken'],
                          },
                      },
                  },
                  {
                      name: 'dropboxOAuth2Api',
                      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',
                      description: 'Means of authenticating with the service',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Folder',
                              value: 'folder',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                          },
                      ],
                      default: 'file',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              name: 'Copy',
                              value: 'copy',
                              description: 'Copy a file',
                              action: 'Copy a file',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a file',
                              action: 'Delete a file',
                          },
                          {
                              name: 'Download',
                              value: 'download',
                              description: 'Download a file',
                              action: 'Download a file',
                          },
                          {
                              name: 'Move',
                              value: 'move',
                              description: 'Move a file',
                              action: 'Move a file',
                          },
                          {
                              name: 'Upload',
                              value: 'upload',
                              description: 'Upload a file',
                              action: 'Upload a file',
                          },
                      ],
                      default: 'upload',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['folder'],
                          },
                      },
                      options: [
                          {
                              name: 'Copy',
                              value: 'copy',
                              description: 'Copy a folder',
                              action: 'Copy a folder',
                          },
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a folder',
                              action: 'Create a folder',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a folder',
                              action: 'Delete a folder',
                          },
                          {
                              name: 'List',
                              value: 'list',
                              description: 'Return the files and folders in a given folder',
                              action: 'List a folder',
                          },
                          {
                              name: 'Move',
                              value: 'move',
                              description: 'Move a folder',
                              action: 'Move a folder',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['search'],
                          },
                      },
                      options: [
                          {
                              name: 'Query',
                              value: 'query',
                              action: 'Query',
                          },
                      ],
                      default: 'query',
                  },
                  {
                      displayName: 'From Path',
                      name: 'path',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['copy'],
                              resource: ['file', 'folder'],
                          },
                      },
                      placeholder: '/invoices/original.txt',
                      description: 'The path of file or folder to copy',
                  },
                  {
                      displayName: 'To Path',
                      name: 'toPath',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['copy'],
                              resource: ['file', 'folder'],
                          },
                      },
                      placeholder: '/invoices/copy.txt',
                      description: 'The destination path of file or folder',
                  },
                  {
                      displayName: 'Delete Path',
                      name: 'path',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['delete'],
                              resource: ['file', 'folder'],
                          },
                      },
                      placeholder: '/invoices/2019/invoice_1.pdf',
                      description: 'The path to delete. Can be a single file or a whole folder.',
                  },
                  {
                      displayName: 'From Path',
                      name: 'path',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['move'],
                              resource: ['file', 'folder'],
                          },
                      },
                      placeholder: '/invoices/old_name.txt',
                      description: 'The path of file or folder to move',
                  },
                  {
                      displayName: 'To Path',
                      name: 'toPath',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['move'],
                              resource: ['file', 'folder'],
                          },
                      },
                      placeholder: '/invoices/new_name.txt',
                      description: 'The new path of file or folder',
                  },
                  {
                      displayName: 'File Path',
                      name: 'path',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['download'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '/invoices/2019/invoice_1.pdf',
                      description: 'The file path of the file to download. Has to contain the full path.',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      required: true,
                      default: 'data',
                      displayOptions: {
                          show: {
                              operation: ['download'],
                              resource: ['file'],
                          },
                      },
                      description: 'Name of the binary property to which to write the data of the read file',
                  },
                  {
                      displayName: 'File Path',
                      name: 'path',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '/invoices/2019/invoice_1.pdf',
                      description: 'The file path of the file to upload. Has to contain the full path. The parent folder has to exist. Existing files get overwritten.',
                  },
                  {
                      displayName: 'Binary Data',
                      name: 'binaryData',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                              resource: ['file'],
                          },
                      },
                      description: 'Whether the data to upload should be taken from binary field',
                  },
                  {
                      displayName: 'File Content',
                      name: 'fileContent',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                              resource: ['file'],
                              binaryData: [false],
                          },
                      },
                      placeholder: '',
                      description: 'The text content of the file to upload',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                              resource: ['file'],
                              binaryData: [true],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property which contains the data for the file to be uploaded',
                  },
                  {
                      displayName: 'Query',
                      name: 'query',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['query'],
                              resource: ['search'],
                          },
                      },
                      description: 'The string to search for. May match across multiple fields based on the request arguments.',
                  },
                  {
                      displayName: 'File Status',
                      name: 'fileStatus',
                      type: 'options',
                      options: [
                          {
                              name: 'Active',
                              value: 'active',
                          },
                          {
                              name: 'Deleted',
                              value: 'deleted',
                          },
                      ],
                      default: 'active',
                      displayOptions: {
                          show: {
                              operation: ['query'],
                              resource: ['search'],
                          },
                      },
                      description: 'The string to search for. May match across multiple fields based on the request arguments.',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['query'],
                              resource: ['search'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      displayOptions: {
                          show: {
                              resource: ['search'],
                              operation: ['query'],
                              returnAll: [false],
                          },
                      },
                      default: 100,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Simplify',
                      name: 'simple',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['query'],
                              resource: ['search'],
                          },
                      },
                      default: true,
                      description: 'Whether to return a simplified version of the response instead of the raw data',
                  },
                  {
                      displayName: 'Filters',
                      name: 'filters',
                      type: 'collection',
                      placeholder: 'Add Filter',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['search'],
                              operation: ['query'],
                          },
                      },
                      options: [
                          {
                              displayName: 'File Categories',
                              name: 'file_categories',
                              type: 'multiOptions',
                              options: [
                                  {
                                      name: 'Audio (mp3, qav, mid, etc.)',
                                      value: 'audio',
                                  },
                                  {
                                      name: 'Document (doc, docx, txt, etc.)',
                                      value: 'document',
                                  },
                                  {
                                      name: 'Dropbox Paper',
                                      value: 'paper',
                                  },
                                  {
                                      name: 'Folder',
                                      value: 'folder',
                                  },
                                  {
                                      name: 'Image (jpg, png, gif, etc.)',
                                      value: 'image',
                                  },
                                  {
                                      name: 'Other',
                                      value: 'other',
                                  },
                                  {
                                      name: 'PDF',
                                      value: 'pdf',
                                  },
                                  {
                                      name: 'Presentation (ppt, pptx, key, etc.)',
                                      value: 'presentation',
                                  },
                                  {
                                      name: 'Spreadsheet (xlsx, xls, csv, etc.)',
                                      value: 'spreadsheet',
                                  },
                                  {
                                      name: 'Video (avi, wmv, mp4, etc.)',
                                      value: 'video',
                                  },
                              ],
                              default: [],
                          },
                          {
                              displayName: 'File Extensions',
                              name: 'file_extensions',
                              type: 'string',
                              default: '',
                              description: 'Multiple file extensions can be set separated by comma. Example: jpg,pdf.',
                          },
                          {
                              displayName: 'Folder',
                              name: 'path',
                              type: 'string',
                              default: '',
                              description: 'If this field is not specified, this module searches the entire Dropbox',
                          },
                      ],
                  },
                  {
                      displayName: 'Folder',
                      name: 'path',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['folder'],
                          },
                      },
                      placeholder: '/invoices/2019',
                      description: 'The folder to create. The parent folder has to exist.',
                  },
                  {
                      displayName: 'Folder Path',
                      name: 'path',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                              resource: ['folder'],
                          },
                      },
                      placeholder: '/invoices/2019/',
                      description: 'The path of which to list the content',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                              resource: ['folder'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      displayOptions: {
                          show: {
                              resource: ['folder'],
                              operation: ['list'],
                              returnAll: [false],
                          },
                      },
                      default: 100,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Filters',
                      name: 'filters',
                      type: 'collection',
                      placeholder: 'Add Filter',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['folder'],
                              operation: ['list'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Include Deleted',
                              name: 'include_deleted',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the results will include entries for files and folders that used to exist but were deleted. The default for this field is False.',
                          },
                          {
                              displayName: 'Include Shared Members',
                              name: 'include_has_explicit_shared_members',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the results will include a flag for each file indicating whether or not that file has any explicit members. The default for this field is False.',
                          },
                          {
                              displayName: 'Include Mounted Folders',
                              name: 'include_mounted_folders',
                              type: 'boolean',
                              default: true,
                              description: 'Whether the results will include entries under mounted folders which includes app folder, shared folder and team folder. The default for this field is True.',
                          },
                          {
                              displayName: 'Include Non Downloadable Files',
                              name: 'include_non_downloadable_files',
                              type: 'boolean',
                              default: true,
                              description: 'Whether to include files that are not downloadable, i.e. Google Docs. The default for this field is True.',
                          },
                          {
                              displayName: 'Recursive',
                              name: 'recursive',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders. The default for this field is False.',
                          },
                      ],
                  },
              ],
          };
      }
      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 returnAll = false;
          let property = '';
          let body;
          let options;
          const query = {};
          let headers = {};
          let simple = false;
          const { accessType } = await GenericFunctions_1.getCredentials.call(this);
          if (accessType === 'full') {
              const { root_info: { root_namespace_id }, } = await GenericFunctions_1.getRootDirectory.call(this);
              headers = {
                  'dropbox-api-path-root': JSON.stringify({
                      '.tag': 'root',
                      root: root_namespace_id,
                  }),
              };
          }
          for (let i = 0; i < items.length; i++) {
              try {
                  body = {};
                  if (resource === 'file') {
                      if (operation === 'download') {
                          requestMethod = 'POST';
                          query.arg = JSON.stringify({
                              path: this.getNodeParameter('path', i),
                          });
                          endpoint = 'https://content.dropboxapi.com/2/files/download';
                      }
                      else if (operation === 'upload') {
                          requestMethod = 'POST';
                          headers['Content-Type'] = 'application/octet-stream';
                          query.arg = JSON.stringify({
                              mode: 'overwrite',
                              path: this.getNodeParameter('path', i),
                          });
                          endpoint = 'https://content.dropboxapi.com/2/files/upload';
                          options = { json: false };
                          if (this.getNodeParameter('binaryData', i)) {
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                              this.helpers.assertBinaryData(i, binaryPropertyName);
                              body = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                          }
                          else {
                              body = Buffer.from(this.getNodeParameter('fileContent', i), 'utf8');
                          }
                      }
                  }
                  else if (resource === 'folder') {
                      if (operation === 'create') {
                          requestMethod = 'POST';
                          body = {
                              path: this.getNodeParameter('path', i),
                          };
                          endpoint = 'https://api.dropboxapi.com/2/files/create_folder_v2';
                      }
                      else if (operation === 'list') {
                          returnAll = this.getNodeParameter('returnAll', 0);
                          const filters = this.getNodeParameter('filters', i);
                          property = 'entries';
                          requestMethod = 'POST';
                          body = {
                              path: this.getNodeParameter('path', i),
                              limit: 1000,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', 0);
                              body.limit = limit;
                          }
                          Object.assign(body, filters);
                          endpoint = 'https://api.dropboxapi.com/2/files/list_folder';
                      }
                  }
                  else if (resource === 'search') {
                      if (operation === 'query') {
                          returnAll = this.getNodeParameter('returnAll', 0);
                          simple = this.getNodeParameter('simple', 0);
                          const filters = this.getNodeParameter('filters', i);
                          property = 'matches';
                          requestMethod = 'POST';
                          body = {
                              query: this.getNodeParameter('query', i),
                              options: {
                                  filename_only: true,
                              },
                          };
                          if (filters.file_extensions) {
                              filters.file_extensions = filters.file_extensions.split(',');
                          }
                          Object.assign(body.options, filters);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              Object.assign(body.options, { max_results: limit });
                          }
                          endpoint = 'https://api.dropboxapi.com/2/files/search_v2';
                      }
                  }
                  if (['file', 'folder', 'search'].includes(resource)) {
                      if (operation === 'copy') {
                          requestMethod = 'POST';
                          body = {
                              from_path: this.getNodeParameter('path', i),
                              to_path: this.getNodeParameter('toPath', i),
                          };
                          endpoint = 'https://api.dropboxapi.com/2/files/copy_v2';
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'POST';
                          body = {
                              path: this.getNodeParameter('path', i),
                          };
                          endpoint = 'https://api.dropboxapi.com/2/files/delete_v2';
                      }
                      else if (operation === 'move') {
                          requestMethod = 'POST';
                          body = {
                              from_path: this.getNodeParameter('path', i),
                              to_path: this.getNodeParameter('toPath', i),
                          };
                          endpoint = 'https://api.dropboxapi.com/2/files/move_v2';
                      }
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
                          itemIndex: i,
                      });
                  }
                  if (resource === 'file' && operation === 'download') {
                      options = { encoding: null };
                  }
                  let responseData;
                  if (returnAll) {
                      responseData = await GenericFunctions_1.dropboxpiRequestAllItems.call(this, property, requestMethod, endpoint, body, query, headers);
                  }
                  else {
                      responseData = await GenericFunctions_1.dropboxApiRequest.call(this, requestMethod, endpoint, body, query, headers, options);
                  }
                  if (resource === 'file' && operation === 'upload') {
                      const data = JSON.parse(responseData);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(data), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
                  else if (resource === 'file' && operation === 'download') {
                      const newItem = {
                          json: items[i].json,
                          binary: {},
                          pairedItem: { item: i },
                      };
                      if (items[i].binary !== undefined) {
                          Object.assign(newItem.binary, items[i].binary);
                      }
                      items[i] = newItem;
                      const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                      const filePathDownload = this.getNodeParameter('path', i);
                      items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(Buffer.from(responseData), filePathDownload);
                  }
                  else if (resource === 'folder' && operation === 'list') {
                      const propNames = {
                          id: 'id',
                          name: 'name',
                          client_modified: 'lastModifiedClient',
                          server_modified: 'lastModifiedServer',
                          rev: 'rev',
                          size: 'contentSize',
                          '.tag': 'type',
                          content_hash: 'contentHash',
                          path_lower: 'pathLower',
                          path_display: 'pathDisplay',
                          has_explicit_shared_members: 'hasExplicitSharedMembers',
                          is_downloadable: 'isDownloadable',
                      };
                      if (!returnAll) {
                          responseData = responseData.entries;
                      }
                      for (const item of responseData) {
                          const newItem = {};
                          for (const propName of Object.keys(propNames)) {
                              if (item[propName] !== undefined) {
                                  newItem[propNames[propName]] = item[propName];
                              }
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(newItem), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
                  else if (resource === 'search' && operation === 'query') {
                      let data = responseData;
                      if (returnAll) {
                          data = simple ? (0, GenericFunctions_1.simplify)(responseData) : responseData;
                      }
                      else {
                          data = simple
                              ? (0, GenericFunctions_1.simplify)(responseData[property])
                              : responseData[property];
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(data), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
                  else {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      if (resource === 'file' && operation === 'download') {
                          items[i].json = { error: error.message };
                      }
                      else {
                          returnData.push({ json: { error: error.message } });
                      }
                      continue;
                  }
                  throw error;
              }
          }
          if (resource === 'file' && operation === 'download') {
              return [items];
          }
          else {
              return [returnData];
          }
      }
  }
  exports.Dropbox = Dropbox;
  //# sourceMappingURL=Dropbox.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DropboxApi = void 0;
  class DropboxApi {
      constructor() {
          this.name = 'dropboxApi';
          this.displayName = 'Dropbox API';
          this.documentationUrl = 'dropbox';
          this.properties = [
              {
                  displayName: 'Access Token',
                  name: 'accessToken',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'APP Access Type',
                  name: 'accessType',
                  type: 'options',
                  options: [
                      {
                          name: 'App Folder',
                          value: 'folder',
                      },
                      {
                          name: 'Full Dropbox',
                          value: 'full',
                      },
                  ],
                  default: 'full',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      Authorization: '=Bearer {{$credentials.accessToken}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: 'https://api.dropboxapi.com/2',
                  url: '/users/get_current_account',
                  method: 'POST',
              },
          };
      }
  }
  exports.DropboxApi = DropboxApi;
  //# sourceMappingURL=DropboxApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DropboxOAuth2Api = void 0;
  const scopes = ['files.content.write', 'files.content.read', 'sharing.read', 'account_info.read'];
  class DropboxOAuth2Api {
      constructor() {
          this.name = 'dropboxOAuth2Api';
          this.extends = ['oAuth2Api'];
          this.displayName = 'Dropbox OAuth2 API';
          this.documentationUrl = 'dropbox';
          this.properties = [
              {
                  displayName: 'Grant Type',
                  name: 'grantType',
                  type: 'hidden',
                  default: 'authorizationCode',
              },
              {
                  displayName: 'Authorization URL',
                  name: 'authUrl',
                  type: 'hidden',
                  default: 'https://www.dropbox.com/oauth2/authorize',
                  required: true,
              },
              {
                  displayName: 'Access Token URL',
                  name: 'accessTokenUrl',
                  type: 'hidden',
                  default: 'https://api.dropboxapi.com/oauth2/token',
                  required: true,
              },
              {
                  displayName: 'Scope',
                  name: 'scope',
                  type: 'hidden',
                  default: scopes.join(' '),
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: 'token_access_type=offline&force_reapprove=true',
              },
              {
                  displayName: 'Authentication',
                  name: 'authentication',
                  type: 'hidden',
                  default: 'header',
              },
              {
                  displayName: 'APP Access Type',
                  name: 'accessType',
                  type: 'options',
                  options: [
                      {
                          name: 'App Folder',
                          value: 'folder',
                      },
                      {
                          name: 'Full Dropbox',
                          value: 'full',
                      },
                  ],
                  default: 'full',
              },
          ];
      }
  }
  exports.DropboxOAuth2Api = DropboxOAuth2Api;
  //# sourceMappingURL=DropboxOAuth2Api.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DropboxApi = void 0;
  class DropboxApi {
      constructor() {
          this.name = 'dropboxApi';
          this.displayName = 'Dropbox API';
          this.documentationUrl = 'dropbox';
          this.properties = [
              {
                  displayName: 'Access Token',
                  name: 'accessToken',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'APP Access Type',
                  name: 'accessType',
                  type: 'options',
                  options: [
                      {
                          name: 'App Folder',
                          value: 'folder',
                      },
                      {
                          name: 'Full Dropbox',
                          value: 'full',
                      },
                  ],
                  default: 'full',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      Authorization: '=Bearer {{$credentials.accessToken}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: 'https://api.dropboxapi.com/2',
                  url: '/users/get_current_account',
                  method: 'POST',
              },
          };
      }
  }
  exports.DropboxApi = DropboxApi;
  //# sourceMappingURL=DropboxApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DropboxOAuth2Api = void 0;
  const scopes = ['files.content.write', 'files.content.read', 'sharing.read', 'account_info.read'];
  class DropboxOAuth2Api {
      constructor() {
          this.name = 'dropboxOAuth2Api';
          this.extends = ['oAuth2Api'];
          this.displayName = 'Dropbox OAuth2 API';
          this.documentationUrl = 'dropbox';
          this.properties = [
              {
                  displayName: 'Grant Type',
                  name: 'grantType',
                  type: 'hidden',
                  default: 'authorizationCode',
              },
              {
                  displayName: 'Authorization URL',
                  name: 'authUrl',
                  type: 'hidden',
                  default: 'https://www.dropbox.com/oauth2/authorize',
                  required: true,
              },
              {
                  displayName: 'Access Token URL',
                  name: 'accessTokenUrl',
                  type: 'hidden',
                  default: 'https://api.dropboxapi.com/oauth2/token',
                  required: true,
              },
              {
                  displayName: 'Scope',
                  name: 'scope',
                  type: 'hidden',
                  default: scopes.join(' '),
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: 'token_access_type=offline&force_reapprove=true',
              },
              {
                  displayName: 'Authentication',
                  name: 'authentication',
                  type: 'hidden',
                  default: 'header',
              },
              {
                  displayName: 'APP Access Type',
                  name: 'accessType',
                  type: 'options',
                  options: [
                      {
                          name: 'App Folder',
                          value: 'folder',
                      },
                      {
                          name: 'Full Dropbox',
                          value: 'full',
                      },
                  ],
                  default: 'full',
              },
          ];
      }
  }
  exports.DropboxOAuth2Api = DropboxOAuth2Api;
  //# sourceMappingURL=DropboxOAuth2Api.credentials.js.map

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

  # Dropbox node

  Use the Dropbox node to automate work in Dropbox, and integrate Dropbox with other applications. n8n has built-in support for a wide range of Dropbox features, including creating, downloading, moving, and copying files and folders.

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

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

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

  ## Operations

  * File
      * Copy a file
      * Delete a file
      * Download a file
      * Move a file
      * Upload a file
  * Folder
      * Copy a folder
      * Create a folder
      * Delete a folder
      * Return the files and folders in a given folder
      * Move a folder
  * Search
      * Query

  ## Templates and examples

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

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

example_workflow:
  {"name":"Dropbox Example Workflow","nodes":[{"parameters":{"authentication":"accessToken","resource":"file","operation":"query","path":"example-value","toPath":"example-value","binaryPropertyName":"Example Name","binaryData":false,"fileContent":"example-value","query":"example-value","fileStatus":"active","returnAll":false,"limit":100,"simple":true,"filters":{}},"id":"hcog3hpd7m1kvqagyu7fd","name":"Dropbox","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

example_parameters:
  {"authentication":"accessToken","resource":"file","operation":"query","path":"example-value","toPath":"example-value","binaryPropertyName":"Example Name","binaryData":false,"fileContent":"example-value","query":"example-value","fileStatus":"active","returnAll":false,"limit":100,"simple":true,"filters":{}}

properties_schema:
  [{"displayName":"Authentication","name":"authentication","type":"options","default":"accessToken","description":"Means of authenticating with the service","options":[{"name":"Access Token","value":"accessToken"},{"name":"OAuth2","value":"oAuth2"}]},{"displayName":"Resource","name":"resource","type":"options","default":"file","options":[{"name":"File","value":"file"},{"name":"Folder","value":"folder"},{"name":"Search","value":"search"}]},{"displayName":"Operation","name":"operation","type":"options","default":"upload","description":"Copy a file","options":[{"name":"Copy","value":"copy","description":"Copy a file"},{"name":"Delete","value":"delete","description":"Delete a file"},{"name":"Download","value":"download","description":"Download a file"},{"name":"Move","value":"move","description":"Move a file"},{"name":"Upload","value":"upload","description":"Upload a file"}]},{"displayName":"Operation","name":"operation","type":"options","default":"create","description":"Copy a folder","options":[{"name":"Copy","value":"copy","description":"Copy a folder"},{"name":"Create","value":"create","description":"Create a folder"},{"name":"Delete","value":"delete","description":"Delete a folder"},{"name":"List","value":"list","description":"Return the files and folders in a given folder"},{"name":"Move","value":"move","description":"Move a folder"}]},{"displayName":"Operation","name":"operation","type":"options","default":"query","options":[{"name":"Query","value":"query"}]},{"displayName":"From Path","name":"path","type":"string","default":"","required":true,"description":"The path of file or folder to copy","placeholder":"/invoices/original.txt"},{"displayName":"To Path","name":"toPath","type":"string","default":"","required":true,"description":"The destination path of file or folder","placeholder":"/invoices/copy.txt"},{"displayName":"Delete Path","name":"path","type":"string","default":"","required":true,"description":"The path to delete. Can be a single file or a whole folder.","placeholder":"/invoices/2019/invoice_1.pdf"},{"displayName":"From Path","name":"path","type":"string","default":"","required":true,"description":"The path of file or folder to move","placeholder":"/invoices/old_name.txt"},{"displayName":"To Path","name":"toPath","type":"string","default":"","required":true,"description":"The new path of file or folder","placeholder":"/invoices/new_name.txt"},{"displayName":"File Path","name":"path","type":"string","default":"","required":true,"description":"The file path of the file to download. Has to contain the full path.","placeholder":"/invoices/2019/invoice_1.pdf"},{"displayName":"Binary Property","name":"binaryPropertyName","type":"string","default":"data","required":true,"description":"Name of the binary property to which to write the data of the read file"},{"displayName":"File Path","name":"path","type":"string","default":"","required":true,"description":"The file path of the file to upload. Has to contain the full path. The parent folder has to exist. Existing files get overwritten.","placeholder":"/invoices/2019/invoice_1.pdf"},{"displayName":"Binary Data","name":"binaryData","type":"boolean","default":false,"description":"Whether the data to upload should be taken from binary field"},{"displayName":"File Content","name":"fileContent","type":"string","default":"","description":"The text content of the file to upload"},{"displayName":"Binary Property","name":"binaryPropertyName","type":"string","default":"data","required":true,"description":"Name of the binary property which contains the data for the file to be uploaded"},{"displayName":"Query","name":"query","type":"string","default":"","required":true,"description":"The string to search for. May match across multiple fields based on the request arguments."},{"displayName":"File Status","name":"fileStatus","type":"options","default":"active","description":"The string to search for. May match across multiple fields based on the request arguments.","options":[{"name":"Active","value":"active"},{"name":"Deleted","value":"deleted"}]},{"displayName":"Return All","name":"returnAll","type":"boolean","default":false,"description":"Whether to return all results or only up to a given limit"},{"displayName":"Limit","name":"limit","type":"number","default":100,"description":"Max number of results to return"},{"displayName":"Simplify","name":"simple","type":"boolean","default":true,"description":"Whether to return a simplified version of the response instead of the raw data"},{"displayName":"Filters","name":"filters","type":"collection","default":"{","description":"Multiple file extensions can be set separated by comma. Example: jpg,pdf.","placeholder":"Add Filter"},{"displayName":"Folder","name":"path","type":"string","default":"","required":true,"description":"The folder to create. The parent folder has to exist.","placeholder":"/invoices/2019"},{"displayName":"Folder Path","name":"path","type":"string","default":"","description":"The path of which to list the content","placeholder":"/invoices/2019/"},{"displayName":"Return All","name":"returnAll","type":"boolean","default":false,"description":"Whether to return all results or only up to a given limit"},{"displayName":"Limit","name":"limit","type":"number","default":100,"description":"Max number of results to return"},{"displayName":"Filters","name":"filters","type":"collection","default":"{","description":"Whether the results will include entries for files and folders that used to exist but were deleted. The default for this field is False.","placeholder":"Add Filter"}]


node_type: n8n-nodes-base.Dropcontact
name: Dropcontact
display_name: Dropcontact
description: Find B2B emails and enrich contacts
category: transform
icon: file:dropcontact.svg
code_hash: cd7a9edf467fd1288617b3ecb6e11942c3dab69d3fc91a543624ca2bed582dc6
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Dropcontact
documentation_title: Dropcontact node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"dropcontact","description":"Templates for dropcontact"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Dropcontact = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunction_1 = require("./GenericFunction");
  class Dropcontact {
      constructor() {
          this.description = {
              displayName: 'Dropcontact',
              name: 'dropcontact',
              icon: 'file:dropcontact.svg',
              group: ['transform'],
              version: 1,
              description: 'Find B2B emails and enrich contacts',
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              defaults: {
                  name: 'Dropcontact',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'dropcontactApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      noDataExpression: true,
                      name: 'resource',
                      type: 'options',
                      options: [
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                      ],
                      default: 'contact',
                      required: true,
                  },
                  {
                      displayName: 'Operation',
                      noDataExpression: true,
                      name: 'operation',
                      type: 'options',
                      options: [
                          {
                              name: 'Enrich',
                              value: 'enrich',
                              description: 'Find B2B emails and enrich your contact from his name and his website',
                              action: 'Find B2B emails',
                          },
                          {
                              name: 'Fetch Request',
                              value: 'fetchRequest',
                          },
                      ],
                      default: 'enrich',
                      required: true,
                  },
                  {
                      displayName: 'Request ID',
                      name: 'requestId',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['contact'],
                              operation: ['fetchRequest'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              resource: ['contact'],
                              operation: ['enrich'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Simplify Output (Faster)',
                      name: 'simplify',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['contact'],
                              operation: ['enrich'],
                          },
                      },
                      default: false,
                      description: 'When off, waits for the contact data before completing. Waiting time can be adjusted with Extend Wait Time option. When on, returns a request_id that can be used later in the Fetch Request operation.',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['contact'],
                              operation: ['enrich'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Company SIREN Number',
                              name: 'num_siren',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Company SIRET Code',
                              name: 'siret',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Company Name',
                              name: 'company',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Country',
                              name: 'country',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'First Name',
                              name: 'first_name',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Full Name',
                              name: 'full_name',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Last Name',
                              name: 'last_name',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'LinkedIn Profile',
                              name: 'linkedin',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Phone Number',
                              name: 'phone',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Website',
                              name: 'website',
                              type: 'string',
                              default: '',
                          },
                      ],
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      displayOptions: {
                          show: {
                              resource: ['contact'],
                              operation: ['enrich'],
                          },
                      },
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Data Fetch Wait Time',
                              name: 'waitTime',
                              type: 'number',
                              typeOptions: {
                                  minValue: 1,
                              },
                              displayOptions: {
                                  show: {
                                      '/simplify': [false],
                                  },
                              },
                              default: 45,
                              description: 'When not simplifying the response, data will be fetched in two steps. This parameter controls how long to wait (in seconds) before trying the second step.',
                          },
                          {
                              displayName: 'French Company Enrich',
                              name: 'siren',
                              type: 'boolean',
                              default: false,
                              description: 'Whether you want the <a href="https://en.wikipedia.org/wiki/SIREN_code" target="_blank">SIREN number</a>, NAF code, TVA number, company address and informations about the company leader. Only applies to french companies.',
                          },
                          {
                              displayName: 'Language',
                              name: 'language',
                              type: 'options',
                              options: [
                                  {
                                      name: 'English',
                                      value: 'en',
                                  },
                                  {
                                      name: 'French',
                                      value: 'fr',
                                  },
                              ],
                              default: 'en',
                              description: 'Whether the response is in English or French',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const entryData = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          const returnData = [];
          if (resource === 'contact') {
              if (operation === 'enrich') {
                  const options = this.getNodeParameter('options', 0);
                  const data = [];
                  const simplify = this.getNodeParameter('simplify', 0);
                  const siren = options.siren === true ? true : false;
                  const language = options.language ? options.language : 'en';
                  for (let i = 0; i < entryData.length; i++) {
                      const email = this.getNodeParameter('email', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {};
                      if (email !== '') {
                          body.email = email;
                      }
                      Object.assign(body, additionalFields);
                      data.push(body);
                  }
                  responseData = (await GenericFunction_1.dropcontactApiRequest.call(this, 'POST', '/batch', { data, siren, language }, {}));
                  if (!responseData.success) {
                      if (this.continueOnFail()) {
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: responseData.reason || 'invalid request' }), {
                              itemData: (0, GenericFunction_1.mapPairedItemsFrom)(entryData),
                          });
                          returnData.push(...executionData);
                      }
                      else {
                          throw new n8n_workflow_1.NodeApiError(this.getNode(), {
                              error: responseData.reason || 'invalid request',
                          });
                      }
                  }
                  if (!simplify) {
                      const waitTime = this.getNodeParameter('options.waitTime', 0, 45);
                      const delay = async (ms) => new Promise((res) => setTimeout(res, ms * 1000));
                      await delay(waitTime);
                      responseData = await GenericFunction_1.dropcontactApiRequest.call(this, 'GET', `/batch/${responseData.request_id}`, {}, {});
                      if (!responseData.success) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: responseData.reason }), {
                                  itemData: (0, GenericFunction_1.mapPairedItemsFrom)(entryData),
                              });
                              returnData.push(...executionData);
                          }
                          else {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), {
                                  error: responseData.reason,
                                  description: 'Hint: Increase the Wait Time to avoid this error',
                              });
                          }
                      }
                      else {
                          responseData.data.forEach((d, index) => {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(d), { itemData: { item: index } });
                              returnData.push(...executionData);
                          });
                      }
                  }
                  else {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), {
                          itemData: (0, GenericFunction_1.mapPairedItemsFrom)(entryData),
                      });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'fetchRequest') {
                  for (let i = 0; i < entryData.length; i++) {
                      const requestId = this.getNodeParameter('requestId', i);
                      responseData = (await GenericFunction_1.dropcontactApiRequest.call(this, 'GET', `/batch/${requestId}`, {}, {}));
                      if (!responseData.success) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: responseData.reason || 'invalid request' }), { itemData: { item: i } });
                              returnData.push(...executionData);
                          }
                          else {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), {
                                  error: responseData.reason || 'invalid request',
                              });
                          }
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData.data), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          return [returnData];
      }
  }
  exports.Dropcontact = Dropcontact;
  //# sourceMappingURL=Dropcontact.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DropcontactApi = void 0;
  class DropcontactApi {
      constructor() {
          this.name = 'dropcontactApi';
          this.displayName = 'Dropcontact API';
          this.documentationUrl = 'dropcontact';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      'user-agent': 'n8n',
                      'X-Access-Token': '={{$credentials.apiKey}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: 'https://api.dropcontact.io',
                  url: '/batch',
                  method: 'POST',
                  body: {
                      data: [{ email: '' }],
                  },
              },
          };
      }
  }
  exports.DropcontactApi = DropcontactApi;
  //# sourceMappingURL=DropcontactApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.DropcontactApi = void 0;
  class DropcontactApi {
      constructor() {
          this.name = 'dropcontactApi';
          this.displayName = 'Dropcontact API';
          this.documentationUrl = 'dropcontact';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      'user-agent': 'n8n',
                      'X-Access-Token': '={{$credentials.apiKey}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: 'https://api.dropcontact.io',
                  url: '/batch',
                  method: 'POST',
                  body: {
                      data: [{ email: '' }],
                  },
              },
          };
      }
  }
  exports.DropcontactApi = DropcontactApi;
  //# sourceMappingURL=DropcontactApi.credentials.js.map

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

  # Dropcontact node

  Use the Dropcontact node to automate work in Dropcontact, and integrate Dropcontact with other applications. n8n has built-in support for a wide range of Dropcontact features, including  fetching contacts. 

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

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

  ## Operations

  **Contact**
  - Enrich
  - Fetch Request

  ## Templates and examples

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

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

example_workflow:
  {"name":"Dropcontact Example Workflow","nodes":[{"parameters":{"resource":"contact","operation":"enrich","requestId":"example-value","email":"user@example.com","simplify":false,"additionalFields":{},"options":{}},"id":"6kxt0ipkaoijfpc441ecoa","name":"Dropcontact","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

example_parameters:
  {"resource":"contact","operation":"enrich","requestId":"example-value","email":"user@example.com","simplify":false,"additionalFields":{},"options":{}}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"contact","required":true,"options":[{"name":"Contact","value":"contact"}]},{"displayName":"Operation","name":"operation","type":"options","default":"enrich","required":true,"description":"Find B2B emails and enrich your contact from his name and his website","options":[{"name":"Enrich","value":"enrich","description":"Find B2B emails and enrich your contact from his name and his website"},{"name":"Fetch Request","value":"fetchRequest"}]},{"displayName":"Request ID","name":"requestId","type":"string","default":"","required":true},{"displayName":"Email","name":"email","type":"string","default":"","placeholder":"name@email.com"},{"displayName":"Simplify Output (Faster)","name":"simplify","type":"boolean","default":false,"description":"When off, waits for the contact data before completing. Waiting time can be adjusted with Extend Wait Time option. When on, returns a request_id that can be used later in the Fetch Request operation."},{"displayName":"Additional Fields","name":"additionalFields","type":"collection","default":"{","placeholder":"Add Field"},{"displayName":"Options","name":"options","type":"collection","default":"{","description":"When not simplifying the response, data will be fetched in two steps. This parameter controls how long to wait (in seconds) before trying the second step.","placeholder":"Add Option"}]


node_type: n8n-nodes-base.Egoi
name: Egoi
display_name: E-goi
description: Consume E-goi API
category: output
icon: file:egoi.png
code_hash: 7959ec1b723673e5851fff364a8c113937b48cf3ed38305425b2874697670c8a
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Egoi
documentation_title: E-goi node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"e-goi","description":"Templates for e-goi"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Egoi = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class Egoi {
      constructor() {
          this.description = {
              displayName: 'E-goi',
              name: 'egoi',
              icon: 'file:egoi.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume E-goi API',
              defaults: {
                  name: 'E-goi',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'egoiApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      options: [
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                      ],
                      default: 'contact',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a member',
                              action: 'Create a member',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a member',
                              action: 'Get a member',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many members',
                              action: 'Get many members',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update a member',
                              action: 'Update a member',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              operation: ['getAll', 'create', 'update', 'get'],
                          },
                      },
                      default: '',
                      description: 'ID of list to operate on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              operation: ['create'],
                          },
                      },
                      default: '',
                      description: 'Email address for a subscriber',
                  },
                  {
                      displayName: 'Contact ID',
                      name: 'contactId',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['contact'],
                              operation: ['update'],
                          },
                      },
                      default: '',
                      description: 'Contact ID of the subscriber',
                  },
                  {
                      displayName: 'Resolve Data',
                      name: 'resolveData',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['create', 'update'],
                          },
                      },
                      default: true,
                      description: 'By default the response just includes the contact ID. If this option gets activated, it will resolve the data automatically.',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['contact'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Birth Date',
                              name: 'birth_date',
                              type: 'dateTime',
                              default: '',
                              description: 'Birth date of a subscriber',
                          },
                          {
                              displayName: 'Cellphone',
                              name: 'cellphone',
                              type: 'string',
                              default: '',
                              description: 'Cellphone of a subscriber',
                          },
                          {
                              displayName: 'Extra Fields',
                              name: 'extraFieldsUi',
                              type: 'fixedCollection',
                              placeholder: 'Add Field',
                              default: {},
                              typeOptions: {
                                  multipleValues: true,
                              },
                              options: [
                                  {
                                      displayName: 'Extra Field',
                                      name: 'extraFieldValues',
                                      typeOptions: {
                                          multipleValueButtonText: 'Add Field',
                                      },
                                      values: [
                                          {
                                              displayName: 'Field Name or ID',
                                              name: 'field_id',
                                              type: 'options',
                                              description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                                              typeOptions: {
                                                  loadOptionsMethod: 'getExtraFields',
                                                  loadOptionsDependsOn: ['list'],
                                              },
                                              default: '',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'First Name',
                              name: 'first_name',
                              type: 'string',
                              default: '',
                              description: 'Name of a subscriber',
                          },
                          {
                              displayName: 'Last Name',
                              name: 'last_name',
                              type: 'string',
                              default: '',
                              description: 'Name of a subscriber',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Unconfirmed',
                                      value: 'unconfirmed',
                                  },
                                  {
                                      name: 'Active',
                                      value: 'active',
                                  },
                                  {
                                      name: 'Inactive',
                                      value: 'inactive',
                                  },
                                  {
                                      name: 'Removed',
                                      value: 'removed',
                                  },
                              ],
                              default: 'active',
                              description: "Subscriber's current status",
                          },
                          {
                              displayName: 'Tag Names or IDs',
                              name: 'tagIds',
                              type: 'multiOptions',
                              typeOptions: {
                                  loadOptionsMethod: 'getListTags',
                              },
                              default: [],
                              description: 'List of tag IDs to be added. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                      ],
                  },
                  {
                      displayName: 'Update Fields',
                      name: 'updateFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['update'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Birth Date',
                              name: 'birth_date',
                              type: 'dateTime',
                              default: '',
                              description: 'Birth date of subscriber',
                          },
                          {
                              displayName: 'Cellphone',
                              name: 'cellphone',
                              type: 'string',
                              default: '',
                              description: 'Cellphone of subscriber',
                          },
                          {
                              displayName: 'Email',
                              name: 'email',
                              type: 'string',
                              placeholder: 'name@email.com',
                              default: '',
                              description: 'Email address for subscriber',
                          },
                          {
                              displayName: 'Extra Fields',
                              name: 'extraFieldsUi',
                              type: 'fixedCollection',
                              placeholder: 'Add Field',
                              default: {},
                              typeOptions: {
                                  multipleValues: true,
                              },
                              options: [
                                  {
                                      displayName: 'Extra Field',
                                      name: 'extraFieldValues',
                                      typeOptions: {
                                          multipleValueButtonText: 'Add Field',
                                      },
                                      values: [
                                          {
                                              displayName: 'Field Name or ID',
                                              name: 'field_id',
                                              type: 'options',
                                              description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                                              typeOptions: {
                                                  loadOptionsMethod: 'getExtraFields',
                                                  loadOptionsDependsOn: ['list'],
                                              },
                                              default: '',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'First Name',
                              name: 'first_name',
                              type: 'string',
                              default: '',
                              description: 'Name of subscriber',
                          },
                          {
                              displayName: 'Last Name',
                              name: 'last_name',
                              type: 'string',
                              default: '',
                              description: 'Name of subscriber',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Unconfirmed',
                                      value: 'unconfirmed',
                                  },
                                  {
                                      name: 'Active',
                                      value: 'active',
                                  },
                                  {
                                      name: 'Inactive',
                                      value: 'inactive',
                                  },
                                  {
                                      name: 'Removed',
                                      value: 'removed',
                                  },
                              ],
                              default: 'active',
                              description: "Subscriber's current status",
                          },
                          {
                              displayName: 'Tag Names or IDs',
                              name: 'tagIds',
                              type: 'multiOptions',
                              typeOptions: {
                                  loadOptionsMethod: 'getListTags',
                              },
                              default: [],
                              description: 'List of tag IDs to be added. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                      ],
                  },
                  {
                      displayName: 'By',
                      name: 'by',
                      type: 'options',
                      options: [
                          {
                              name: 'Contact ID',
                              value: 'id',
                          },
                          {
                              name: 'Email',
                              value: 'email',
                          },
                      ],
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['contact'],
                          },
                      },
                      default: 'id',
                      description: 'Search by',
                  },
                  {
                      displayName: 'Contact ID',
                      name: 'contactId',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['contact'],
                              operation: ['get'],
                              by: ['id'],
                          },
                      },
                      default: '',
                      description: 'Contact ID of the subscriber',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              resource: ['contact'],
                              operation: ['get'],
                              by: ['email'],
                          },
                      },
                      default: '',
                      description: 'Email address for subscriber',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['getAll'],
                              resource: ['contact'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              operation: ['getAll'],
                              resource: ['contact'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 500,
                      },
                      default: 100,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Simplify',
                      name: 'simple',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['get', 'getAll'],
                              resource: ['contact'],
                          },
                      },
                      default: true,
                      description: 'Whether to return a simplified version of the response instead of the raw data',
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLists() {
                      const returnData = [];
                      const lists = await GenericFunctions_1.egoiApiRequestAllItems.call(this, 'items', 'GET', '/lists');
                      for (const list of lists) {
                          const listName = list.internal_name;
                          const listId = list.list_id;
                          returnData.push({
                              name: listName,
                              value: listId,
                          });
                      }
                      return returnData;
                  },
                  async getExtraFields() {
                      const returnData = [];
                      const listId = this.getCurrentNodeParameter('list');
                      const extraFields = await GenericFunctions_1.egoiApiRequest.call(this, 'GET', `/lists/${listId}/fields`);
                      for (const field of extraFields) {
                          if (field.type === 'extra') {
                              const fieldName = field.name;
                              const fieldId = field.field_id;
                              returnData.push({
                                  name: fieldName,
                                  value: fieldId,
                              });
                          }
                      }
                      return returnData;
                  },
                  async getListTags() {
                      const returnData = [];
                      const tagList = await GenericFunctions_1.egoiApiRequestAllItems.call(this, 'items', 'GET', '/tags');
                      for (const tag of tagList) {
                          const tagName = tag.name;
                          const tagId = tag.tag_id;
                          returnData.push({
                              name: tagName,
                              value: tagId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          let responseData;
          const returnData = [];
          const items = this.getInputData();
          const length = items.length;
          const operation = this.getNodeParameter('operation', 0);
          const resource = this.getNodeParameter('resource', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'contact') {
                      if (operation === 'create') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const resolveData = this.getNodeParameter('resolveData', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              base: {
                                  email,
                              },
                              extra: [],
                          };
                          if (additionalFields.birth_date) {
                              additionalFields.birth_date = (0, moment_timezone_1.default)(additionalFields.birth_date).format('YYYY-MM-DD');
                          }
                          if (additionalFields.extraFieldsUi) {
                              const extraFields = additionalFields.extraFieldsUi
                                  .extraFieldValues;
                              if (extraFields) {
                                  body.extra = extraFields;
                              }
                          }
                          Object.assign(body.base, additionalFields);
                          responseData = await GenericFunctions_1.egoiApiRequest.call(this, 'POST', `/lists/${listId}/contacts`, body);
                          const contactId = responseData.contact_id;
                          if (additionalFields.tagIds) {
                              const tags = additionalFields.tagIds;
                              for (const tag of tags) {
                                  await GenericFunctions_1.egoiApiRequest.call(this, 'POST', `/lists/${listId}/contacts/actions/attach-tag`, { tag_id: tag, contacts: [contactId] });
                              }
                          }
                          if (resolveData) {
                              responseData = await GenericFunctions_1.egoiApiRequest.call(this, 'GET', `/lists/${listId}/contacts/${contactId}`);
                          }
                      }
                      if (operation === 'get') {
                          const listId = this.getNodeParameter('list', i);
                          const simple = this.getNodeParameter('simple', i);
                          const by = this.getNodeParameter('by', 0);
                          let endpoint = '';
                          if (by === 'id') {
                              const contactId = this.getNodeParameter('contactId', i);
                              endpoint = `/lists/${listId}/contacts/${contactId}`;
                          }
                          else {
                              const email = this.getNodeParameter('email', i);
                              endpoint = `/lists/${listId}/contacts?email=${email}`;
                          }
                          responseData = await GenericFunctions_1.egoiApiRequest.call(this, 'GET', endpoint, {});
                          if (responseData.items) {
                              responseData = responseData.items;
                          }
                          if (simple) {
                              const data = (await GenericFunctions_1.simplify.call(this, [responseData], listId))[0];
                              responseData = {
                                  ...data,
                                  email_stats: responseData.email_stats,
                                  sms_stats: responseData.sms_stats,
                                  push_stats: responseData.push_stats,
                                  webpush_stats: responseData.webpush_stats,
                                  voice_stats: responseData.voice_stats,
                              };
                          }
                      }
                      if (operation === 'getAll') {
                          const listId = this.getNodeParameter('list', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const simple = this.getNodeParameter('simple', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.egoiApiRequestAllItems.call(this, 'items', 'GET', `/lists/${listId}/contacts`, {});
                          }
                          else {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.egoiApiRequest.call(this, 'GET', `/lists/${listId}/contacts`, {}, { limit });
                              responseData = responseData.items;
                          }
                          if (simple) {
                              responseData = await GenericFunctions_1.simplify.call(this, responseData, listId);
                          }
                      }
                      if (operation === 'update') {
                          const listId = this.getNodeParameter('list', i);
                          const contactId = this.getNodeParameter('contactId', i);
                          const resolveData = this.getNodeParameter('resolveData', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {
                              base: {},
                              extra: [],
                          };
                          if (updateFields.birth_date) {
                              updateFields.birth_date = (0, moment_timezone_1.default)(updateFields.birth_date).format('YYYY-MM-DD');
                          }
                          if (updateFields.extraFieldsUi) {
                              const extraFields = updateFields.extraFieldsUi
                                  .extraFieldValues;
                              if (extraFields) {
                                  body.extra = extraFields;
                              }
                          }
                          Object.assign(body.base, updateFields);
                          responseData = await GenericFunctions_1.egoiApiRequest.call(this, 'PATCH', `/lists/${listId}/contacts/${contactId}`, body);
                          if (updateFields.tagIds) {
                              const tags = updateFields.tagIds;
                              for (const tag of tags) {
                                  await GenericFunctions_1.egoiApiRequest.call(this, 'POST', `/lists/${listId}/contacts/actions/attach-tag`, { tag_id: tag, contacts: [contactId] });
                              }
                          }
                          if (resolveData) {
                              responseData = await GenericFunctions_1.egoiApiRequest.call(this, 'GET', `/lists/${listId}/contacts/${contactId}`);
                          }
                      }
                  }
              }
              catch (error) {
                  if (!this.continueOnFail()) {
                      throw error;
                  }
                  else {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Egoi = Egoi;
  //# sourceMappingURL=Egoi.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.EgoiApi = void 0;
  class EgoiApi {
      constructor() {
          this.name = 'egoiApi';
          this.displayName = 'E-Goi API';
          this.documentationUrl = 'egoi';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
      }
  }
  exports.EgoiApi = EgoiApi;
  //# sourceMappingURL=EgoiApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.EgoiApi = void 0;
  class EgoiApi {
      constructor() {
          this.name = 'egoiApi';
          this.displayName = 'E-Goi API';
          this.documentationUrl = 'egoi';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
      }
  }
  exports.EgoiApi = EgoiApi;
  //# sourceMappingURL=EgoiApi.credentials.js.map

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

  # E-goi node

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

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

  /// note | Credentials
  Refer to [E-goi credentials](/integrations/builtin/credentials/egoi.md) for guidance on setting up authentication. 
  ///

  ## Operations

  **Contact**

  - Create a member
  - Get a member
  - Get all members
  - Update a member

  ## Templates and examples

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

example_workflow:
  {"name":"E-goi Example Workflow","nodes":[{"parameters":{"resource":"contact","operation":"create","list":"","email":"user@example.com","contactId":"example-value","resolveData":true,"additionalFields":{},"updateFields":{},"by":"id","returnAll":false,"limit":100,"simple":true},"id":"7a7kzyj0ktnwrfzafrdcg","name":"E-goi","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

example_parameters:
  {"resource":"contact","operation":"create","list":"","email":"user@example.com","contactId":"example-value","resolveData":true,"additionalFields":{},"updateFields":{},"by":"id","returnAll":false,"limit":100,"simple":true}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"contact","required":true,"options":[{"name":"Contact","value":"contact"}]},{"displayName":"Operation","name":"operation","type":"options","default":"create","required":true,"description":"Create a member","options":[{"name":"Create","value":"create","description":"Create a member"},{"name":"Get","value":"get","description":"Get a member"},{"name":"Get Many","value":"getAll","description":"Get many members"},{"name":"Update","value":"update","description":"Update a member"}]},{"displayName":"List Name or ID","name":"list","type":"options","default":"","description":"ID of list to operate on. Choose from the list, or specify an ID using an <a href="},{"displayName":"Email","name":"email","type":"string","default":"","description":"Email address for a subscriber","placeholder":"name@email.com"},{"displayName":"Contact ID","name":"contactId","type":"string","default":"","description":"Contact ID of the subscriber"},{"displayName":"Resolve Data","name":"resolveData","type":"boolean","default":true,"description":"By default the response just includes the contact ID. If this option gets activated, it will resolve the data automatically."},{"displayName":"Additional Fields","name":"additionalFields","type":"collection","default":"{","description":"Birth date of a subscriber","placeholder":"Add Field"},{"displayName":"Update Fields","name":"updateFields","type":"collection","default":"{","description":"Birth date of subscriber","placeholder":"Add Field"},{"displayName":"By","name":"by","type":"options","default":"id","description":"Search by","options":[{"name":"Contact ID","value":"id"},{"name":"Email","value":"email"}]},{"displayName":"Contact ID","name":"contactId","type":"string","default":"","description":"Contact ID of the subscriber"},{"displayName":"Email","name":"email","type":"string","default":"","description":"Email address for subscriber","placeholder":"name@email.com"},{"displayName":"Return All","name":"returnAll","type":"boolean","default":false,"description":"Whether to return all results or only up to a given limit"},{"displayName":"Limit","name":"limit","type":"number","default":100,"description":"Max number of results to return"},{"displayName":"Simplify","name":"simple","type":"boolean","default":true,"description":"Whether to return a simplified version of the response instead of the raw data"}]


node_type: n8n-nodes-base.EmailReadImap
name: EmailReadImap
display_name: Email Trigger (IMAP)
description: Triggers the workflow when a new email is received
category: trigger
icon: fa:inbox
code_hash: b3d4946398bf3fb32954b1d50cef910b0831f468d4d364cf5288676b41d43a53
example_parameters: {"pollTimes":{"item":[{"mode":"everyMinute"}]}}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.EmailReadImap = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const EmailReadImapV1_node_1 = require("./v1/EmailReadImapV1.node");
  const EmailReadImapV2_node_1 = require("./v2/EmailReadImapV2.node");
  class EmailReadImap extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Email Trigger (IMAP)',
              name: 'emailReadImap',
              icon: 'fa:inbox',
              group: ['trigger'],
              description: 'Triggers the workflow when a new email is received',
              defaultVersion: 2,
          };
          const nodeVersions = {
              1: new EmailReadImapV1_node_1.EmailReadImapV1(baseDescription),
              2: new EmailReadImapV2_node_1.EmailReadImapV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.EmailReadImap = EmailReadImap;
  //# sourceMappingURL=EmailReadImap.node.js.map

example_workflow:
  {"name":"Email Trigger (IMAP) Example Workflow","nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]}},"id":"9nddord8cv7ojkbbzx8na","name":"Email Trigger (IMAP)","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}


node_type: n8n-nodes-base.ElasticSecurity
name: ElasticSecurity
display_name: Elastic Security
description: Consume the Elastic Security API
category: transform
icon: file:elasticSecurity.svg
code_hash: d63c1501e626316617d40fe0f6070a3506e512574eba3c6663360949ee49cb87
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.ElasticSecurity
documentation_title: Elastic Security node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"elastic-security","description":"Templates for elastic-security"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"case","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ElasticSecurity = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  class ElasticSecurity {
      constructor() {
          this.description = {
              displayName: 'Elastic Security',
              name: 'elasticSecurity',
              icon: 'file:elasticSecurity.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Elastic Security API',
              defaults: {
                  name: 'Elastic Security',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'elasticSecurityApi',
                      required: true,
                      testedBy: 'elasticSecurityApiTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      noDataExpression: true,
                      type: 'options',
                      options: [
                          {
                              name: 'Case',
                              value: 'case',
                          },
                          {
                              name: 'Case Comment',
                              value: 'caseComment',
                          },
                          {
                              name: 'Case Tag',
                              value: 'caseTag',
                          },
                          {
                              name: 'Connector',
                              value: 'connector',
                          },
                      ],
                      default: 'case',
                  },
                  ...descriptions_1.caseOperations,
                  ...descriptions_1.caseFields,
                  ...descriptions_1.caseCommentOperations,
                  ...descriptions_1.caseCommentFields,
                  ...descriptions_1.caseTagOperations,
                  ...descriptions_1.caseTagFields,
                  ...descriptions_1.connectorOperations,
                  ...descriptions_1.connectorFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTags() {
                      const tags = (await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'GET', '/cases/tags'));
                      return tags.map((tag) => ({ name: tag, value: tag }));
                  },
                  async getConnectors() {
                      const endpoint = '/cases/configure/connectors/_find';
                      const connectors = (await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'GET', endpoint));
                      return connectors.map(({ name, id }) => ({ name, value: id }));
                  },
              },
              credentialTest: {
                  async elasticSecurityApiTest(credential) {
                      const { username, password, baseUrl: rawBaseUrl, } = credential.data;
                      const baseUrl = (0, GenericFunctions_1.tolerateTrailingSlash)(rawBaseUrl);
                      const token = Buffer.from(`${username}:${password}`).toString('base64');
                      const endpoint = '/cases/status';
                      const options = {
                          headers: {
                              Authorization: `Basic ${token}`,
                              'kbn-xsrf': true,
                          },
                          method: 'GET',
                          body: {},
                          qs: {},
                          uri: `${baseUrl}/api${endpoint}`,
                          json: true,
                      };
                      try {
                          await this.helpers.request(options);
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                  },
              },
          };
      }
      async execute() {
          var _a, _b;
          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 === 'case') {
                      if (operation === 'create') {
                          const body = {
                              title: this.getNodeParameter('title', i),
                              connector: {},
                              owner: 'securitySolution',
                              description: '',
                              tags: [],
                              settings: {
                                  syncAlerts: this.getNodeParameter('additionalFields.syncAlerts', i, false),
                              },
                          };
                          const connectorId = this.getNodeParameter('connectorId', i);
                          const { id: fetchedId, name: fetchedName, type: fetchedType, } = await GenericFunctions_1.getConnector.call(this, connectorId);
                          const selectedConnectorType = this.getNodeParameter('connectorType', i);
                          if (fetchedType !== selectedConnectorType) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Connector Type does not match the type of the connector in Connector Name', { itemIndex: i });
                          }
                          const connector = {
                              id: fetchedId,
                              name: fetchedName,
                              type: fetchedType,
                              fields: {},
                          };
                          if (selectedConnectorType === '.jira') {
                              connector.fields = {
                                  issueType: this.getNodeParameter('issueType', i),
                                  priority: this.getNodeParameter('priority', i),
                                  parent: null,
                              };
                          }
                          else if (selectedConnectorType === '.servicenow') {
                              connector.fields = {
                                  urgency: this.getNodeParameter('urgency', i),
                                  severity: this.getNodeParameter('severity', i),
                                  impact: this.getNodeParameter('impact', i),
                                  category: this.getNodeParameter('category', i),
                                  subcategory: null,
                              };
                          }
                          else if (selectedConnectorType === '.resilient') {
                              const rawIssueTypes = this.getNodeParameter('issueTypes', i);
                              connector.fields = {
                                  issueTypes: rawIssueTypes.split(',').map(Number),
                                  severityCode: this.getNodeParameter('severityCode', i),
                                  incidentTypes: null,
                              };
                          }
                          body.connector = connector;
                          const { syncAlerts, ...rest } = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(rest).length) {
                              Object.assign(body, rest);
                          }
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'POST', '/cases', body);
                      }
                      else if (operation === 'delete') {
                          const caseId = this.getNodeParameter('caseId', i);
                          await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'DELETE', `/cases?ids=["${caseId}"]`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const caseId = this.getNodeParameter('caseId', i);
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'GET', `/cases/${caseId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const { tags, status } = this.getNodeParameter('filters', i);
                          const sortOptions = this.getNodeParameter('sortOptions', i);
                          qs.sortField = (_a = sortOptions.sortField) !== null && _a !== void 0 ? _a : 'createdAt';
                          qs.sortOrder = (_b = sortOptions.sortOrder) !== null && _b !== void 0 ? _b : 'asc';
                          if (status) {
                              qs.status = status;
                          }
                          if (tags === null || tags === void 0 ? void 0 : tags.length) {
                              qs.tags = tags.join(',');
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/cases/_find', {}, qs);
                      }
                      else if (operation === 'getStatus') {
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'GET', '/cases/status');
                      }
                      else if (operation === 'update') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if (!Object.keys(updateFields).length) {
                              GenericFunctions_1.throwOnEmptyUpdate.call(this, resource);
                          }
                          const { syncAlerts, ...rest } = updateFields;
                          Object.assign(body, {
                              cases: [
                                  {
                                      id: caseId,
                                      version: await GenericFunctions_1.getVersion.call(this, `/cases/${caseId}`),
                                      ...(syncAlerts && { settings: { syncAlerts } }),
                                      ...rest,
                                  },
                              ],
                          });
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'PATCH', '/cases', body);
                      }
                  }
                  else if (resource === 'caseTag') {
                      if (operation === 'add') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const { title, connector, owner, description, settings, tags } = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'GET', `/cases/${caseId}`);
                          const tagToAdd = this.getNodeParameter('tag', i);
                          if (tags.includes(tagToAdd)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Cannot add tag "${tagToAdd}" to case ID ${caseId} because this case already has this tag.`, { itemIndex: i });
                          }
                          const body = {};
                          Object.assign(body, {
                              cases: [
                                  {
                                      id: caseId,
                                      title,
                                      connector,
                                      owner,
                                      description,
                                      settings,
                                      version: await GenericFunctions_1.getVersion.call(this, `/cases/${caseId}`),
                                      tags: [...tags, tagToAdd],
                                  },
                              ],
                          });
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'PATCH', '/cases', body);
                      }
                      else if (operation === 'remove') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const tagToRemove = this.getNodeParameter('tag', i);
                          const { title, connector, owner, description, settings, tags } = (await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'GET', `/cases/${caseId}`));
                          if (!tags.includes(tagToRemove)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Cannot remove tag "${tagToRemove}" from case ID ${caseId} because this case does not have this tag.`, { itemIndex: i });
                          }
                          const body = {};
                          Object.assign(body, {
                              cases: [
                                  {
                                      id: caseId,
                                      title,
                                      connector,
                                      owner,
                                      description,
                                      settings,
                                      version: await GenericFunctions_1.getVersion.call(this, `/cases/${caseId}`),
                                      tags: tags.filter((tag) => tag !== tagToRemove),
                                  },
                              ],
                          });
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'PATCH', '/cases', body);
                      }
                  }
                  else if (resource === 'caseComment') {
                      if (operation === 'add') {
                          const simple = this.getNodeParameter('simple', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              comment: this.getNodeParameter('comment', i),
                              type: 'user',
                              owner: additionalFields.owner || 'securitySolution',
                          };
                          const caseId = this.getNodeParameter('caseId', i);
                          const endpoint = `/cases/${caseId}/comments`;
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'POST', endpoint, body);
                          if (simple) {
                              const { comments } = responseData;
                              responseData = comments[comments.length - 1];
                          }
                      }
                      else if (operation === 'get') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const commentId = this.getNodeParameter('commentId', i);
                          const endpoint = `/cases/${caseId}/comments/${commentId}`;
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const endpoint = `/cases/${caseId}/comments`;
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'remove') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const commentId = this.getNodeParameter('commentId', i);
                          const endpoint = `/cases/${caseId}/comments/${commentId}`;
                          await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'DELETE', endpoint);
                          responseData = { success: true };
                      }
                      else if (operation === 'update') {
                          const simple = this.getNodeParameter('simple', i);
                          const caseId = this.getNodeParameter('caseId', i);
                          const commentId = this.getNodeParameter('commentId', i);
                          const body = {
                              comment: this.getNodeParameter('comment', i),
                              id: commentId,
                              type: 'user',
                              owner: 'securitySolution',
                              version: await GenericFunctions_1.getVersion.call(this, `/cases/${caseId}/comments/${commentId}`),
                          };
                          const patchEndpoint = `/cases/${caseId}/comments`;
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'PATCH', patchEndpoint, body);
                          if (simple) {
                              const { comments } = responseData;
                              responseData = comments[comments.length - 1];
                          }
                      }
                  }
                  else if (resource === 'connector') {
                      if (operation === 'create') {
                          const connectorType = this.getNodeParameter('connectorType', i);
                          const body = {
                              connector_type_id: connectorType,
                              name: this.getNodeParameter('name', i),
                          };
                          if (connectorType === '.jira') {
                              body.config = {
                                  apiUrl: this.getNodeParameter('apiUrl', i),
                                  projectKey: this.getNodeParameter('projectKey', i),
                              };
                              body.secrets = {
                                  email: this.getNodeParameter('email', i),
                                  apiToken: this.getNodeParameter('apiToken', i),
                              };
                          }
                          else if (connectorType === '.resilient') {
                              body.config = {
                                  apiUrl: this.getNodeParameter('apiUrl', i),
                                  orgId: this.getNodeParameter('orgId', i),
                              };
                              body.secrets = {
                                  apiKeyId: this.getNodeParameter('apiKeyId', i),
                                  apiKeySecret: this.getNodeParameter('apiKeySecret', i),
                              };
                          }
                          else if (connectorType === '.servicenow') {
                              body.config = {
                                  apiUrl: this.getNodeParameter('apiUrl', i),
                              };
                              body.secrets = {
                                  username: this.getNodeParameter('username', i),
                                  password: this.getNodeParameter('password', i),
                              };
                          }
                          responseData = await GenericFunctions_1.elasticSecurityApiRequest.call(this, 'POST', '/actions/connector', 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.ElasticSecurity = ElasticSecurity;
  //# sourceMappingURL=ElasticSecurity.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ElasticSecurityApi = void 0;
  class ElasticSecurityApi {
      constructor() {
          this.name = 'elasticSecurityApi';
          this.displayName = 'Elastic Security API';
          this.documentationUrl = 'elasticSecurity';
          this.properties = [
              {
                  displayName: 'Username',
                  name: 'username',
                  type: 'string',
                  default: '',
                  required: true,
              },
              {
                  displayName: 'Password',
                  name: 'password',
                  type: 'string',
                  typeOptions: {
                      password: true,
                  },
                  default: '',
                  required: true,
              },
              {
                  displayName: 'Base URL',
                  name: 'baseUrl',
                  type: 'string',
                  default: '',
                  placeholder: 'e.g. https://mydeployment.kb.us-central1.gcp.cloud.es.io:9243',
                  description: "Referred to as Kibana 'endpoint' in the Elastic deployment dashboard",
                  required: true,
              },
          ];
      }
  }
  exports.ElasticSecurityApi = ElasticSecurityApi;
  //# sourceMappingURL=ElasticSecurityApi.credentials.js.map

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

  # Elastic Security node

  Use the Elastic Security node to automate work in Elastic Security, and integrate Elastic Security with other applications. n8n's has built-in support for a wide range of Elastic Security features, including creating, updating, deleting, retrieving, and getting cases.

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

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

  ## Operations

  * Case
      * Create a case
      * Delete a case
      * Get a case
      * Retrieve all cases
      * Retrieve a summary of all case activity
      * Update a case
  * Case Comment
      * Add a comment to a case
      * Get a case comment
      * Retrieve all case comments
      * Remove a comment from a case
      * Update a comment in a case
  * Case Tag
      * Add a tag to a case
      * Remove a tag from a case
  * Connector
      * Create a connector

  ## Templates and examples

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

example_workflow:
  {"name":"Elastic Security Example Workflow","nodes":[{"parameters":{"resource":"case","dynamic_property":null},"id":"trgtu81jnppbjy61hmbp2a","name":"Elastic Security","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"case","options":[{"name":"Case","value":"case"},{"name":"Case Comment","value":"caseComment"},{"name":"Case Tag","value":"caseTag"},{"name":"Connector","value":"connector"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.caseOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.caseFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.caseCommentOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.caseCommentFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.caseTagOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.caseTagFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.connectorOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.connectorFields"}]


node_type: n8n-nodes-base.Elasticsearch
name: Elasticsearch
display_name: Elasticsearch
description: Consume the Elasticsearch API
category: transform
icon: file:elasticsearch.svg
code_hash: 1a912478e4feb858d6fae8d87b347488d464bc2349ae630d36f52c53db076273
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Elasticsearch
documentation_title: Elasticsearch node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"elasticsearch","description":"Templates for elasticsearch"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"document","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:29
updated_at: 2025-06-12 08:58:29
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Elasticsearch = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  const omit_1 = __importDefault(require("lodash/omit"));
  class Elasticsearch {
      constructor() {
          this.description = {
              displayName: 'Elasticsearch',
              name: 'elasticsearch',
              icon: 'file:elasticsearch.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Elasticsearch API',
              defaults: {
                  name: 'Elasticsearch',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'elasticsearchApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Document',
                              value: 'document',
                          },
                          {
                              name: 'Index',
                              value: 'index',
                          },
                      ],
                      default: 'document',
                  },
                  ...descriptions_1.documentOperations,
                  ...descriptions_1.documentFields,
                  ...descriptions_1.indexOperations,
                  ...descriptions_1.indexFields,
              ],
          };
      }
      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++) {
              if (resource === 'document') {
                  if (operation === 'delete') {
                      const indexId = this.getNodeParameter('indexId', i);
                      const documentId = this.getNodeParameter('documentId', i);
                      const endpoint = `/${indexId}/_doc/${documentId}`;
                      responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'DELETE', endpoint);
                  }
                  else if (operation === 'get') {
                      const indexId = this.getNodeParameter('indexId', i);
                      const documentId = this.getNodeParameter('documentId', i);
                      const qs = {};
                      const options = this.getNodeParameter('options', i);
                      if (Object.keys(options).length) {
                          Object.assign(qs, options);
                          qs._source = true;
                      }
                      const endpoint = `/${indexId}/_doc/${documentId}`;
                      responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'GET', endpoint, {}, qs);
                      const simple = this.getNodeParameter('simple', i);
                      if (simple) {
                          responseData = {
                              _id: responseData._id,
                              ...responseData._source,
                          };
                      }
                  }
                  else if (operation === 'getAll') {
                      const indexId = this.getNodeParameter('indexId', i);
                      const body = {};
                      const qs = {};
                      const options = this.getNodeParameter('options', i);
                      if (Object.keys(options).length) {
                          const { query, ...rest } = options;
                          if (query) {
                              Object.assign(body, (0, n8n_workflow_1.jsonParse)(query, { errorMessage: "Invalid JSON in 'Query' option" }));
                          }
                          Object.assign(qs, rest);
                          qs._source = true;
                      }
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      if (returnAll) {
                          qs.size = 10000;
                          if (qs.sort) {
                              responseData = await GenericFunctions_1.elasticsearchApiRequestAllItems.call(this, indexId, body, qs);
                          }
                          else {
                              responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'GET', `/${indexId}/_search`, body, qs);
                              responseData = responseData.hits.hits;
                          }
                      }
                      else {
                          qs.size = this.getNodeParameter('limit', 0);
                          responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'GET', `/${indexId}/_search`, body, qs);
                          responseData = responseData.hits.hits;
                      }
                      const simple = this.getNodeParameter('simple', 0);
                      if (simple) {
                          responseData = responseData.map((item) => {
                              return {
                                  _id: item._id,
                                  ...item._source,
                              };
                          });
                      }
                  }
                  else if (operation === 'create') {
                      const body = {};
                      const dataToSend = this.getNodeParameter('dataToSend', 0);
                      if (dataToSend === 'defineBelow') {
                          const fields = this.getNodeParameter('fieldsUi.fieldValues', i, []);
                          fields.forEach(({ fieldId, fieldValue }) => (body[fieldId] = fieldValue));
                      }
                      else {
                          const inputData = items[i].json;
                          const rawInputsToIgnore = this.getNodeParameter('inputsToIgnore', i);
                          const inputsToIgnore = rawInputsToIgnore.split(',').map((c) => c.trim());
                          for (const key of Object.keys(inputData)) {
                              if (inputsToIgnore.includes(key))
                                  continue;
                              body[key] = inputData[key];
                          }
                      }
                      const qs = {};
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (Object.keys(additionalFields).length) {
                          Object.assign(qs, (0, omit_1.default)(additionalFields, ['documentId']));
                      }
                      const indexId = this.getNodeParameter('indexId', i);
                      const { documentId } = additionalFields;
                      if (documentId) {
                          const endpoint = `/${indexId}/_doc/${documentId}`;
                          responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'PUT', endpoint, body);
                      }
                      else {
                          const endpoint = `/${indexId}/_doc`;
                          responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'POST', endpoint, body);
                      }
                  }
                  else if (operation === 'update') {
                      const body = { doc: {} };
                      const dataToSend = this.getNodeParameter('dataToSend', 0);
                      if (dataToSend === 'defineBelow') {
                          const fields = this.getNodeParameter('fieldsUi.fieldValues', i, []);
                          fields.forEach(({ fieldId, fieldValue }) => (body.doc[fieldId] = fieldValue));
                      }
                      else {
                          const inputData = items[i].json;
                          const rawInputsToIgnore = this.getNodeParameter('inputsToIgnore', i);
                          const inputsToIgnore = rawInputsToIgnore.split(',').map((c) => c.trim());
                          for (const key of Object.keys(inputData)) {
                              if (inputsToIgnore.includes(key))
                                  continue;
                              body.doc[key] = inputData[key];
                          }
                      }
                      const indexId = this.getNodeParameter('indexId', i);
                      const documentId = this.getNodeParameter('documentId', i);
                      const endpoint = `/${indexId}/_update/${documentId}`;
                      responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'POST', endpoint, body);
                  }
              }
              else if (resource === 'index') {
                  if (operation === 'create') {
                      const indexId = this.getNodeParameter('indexId', i);
                      const body = {};
                      const qs = {};
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (Object.keys(additionalFields).length) {
                          const { aliases, mappings, settings, ...rest } = additionalFields;
                          Object.assign(body, aliases, mappings, settings);
                          Object.assign(qs, rest);
                      }
                      responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'PUT', `/${indexId}`);
                      responseData = { id: indexId, ...responseData };
                      delete responseData.index;
                  }
                  else if (operation === 'delete') {
                      const indexId = this.getNodeParameter('indexId', i);
                      responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'DELETE', `/${indexId}`);
                      responseData = { success: true };
                  }
                  else if (operation === 'get') {
                      const indexId = this.getNodeParameter('indexId', i);
                      const qs = {};
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (Object.keys(additionalFields).length) {
                          Object.assign(qs, additionalFields);
                      }
                      responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'GET', `/${indexId}`, {}, qs);
                      responseData = { id: indexId, ...responseData[indexId] };
                  }
                  else if (operation === 'getAll') {
                      responseData = await GenericFunctions_1.elasticsearchApiRequest.call(this, 'GET', '/_aliases');
                      responseData = Object.keys(responseData).map((index) => ({
                          indexId: index,
                      }));
                      const returnAll = this.getNodeParameter('returnAll', i);
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.slice(0, limit);
                      }
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Elasticsearch = Elasticsearch;
  //# sourceMappingURL=Elasticsearch.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ElasticsearchApi = void 0;
  class ElasticsearchApi {
      constructor() {
          this.name = 'elasticsearchApi';
          this.displayName = 'Elasticsearch API';
          this.documentationUrl = 'elasticsearch';
          this.properties = [
              {
                  displayName: 'Username',
                  name: 'username',
                  type: 'string',
                  default: '',
              },
              {
                  displayName: 'Password',
                  name: 'password',
                  type: 'string',
                  typeOptions: {
                      password: true,
                  },
                  default: '',
              },
              {
                  displayName: 'Base URL',
                  name: 'baseUrl',
                  type: 'string',
                  default: '',
                  placeholder: 'https://mydeployment.es.us-central1.gcp.cloud.es.io:9243',
                  description: "Referred to as Elasticsearch 'endpoint' in the Elastic deployment dashboard",
              },
              {
                  displayName: 'Ignore SSL Issues',
                  name: 'ignoreSSLIssues',
                  type: 'boolean',
                  default: false,
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  auth: {
                      username: '={{$credentials.username}}',
                      password: '={{$credentials.password}}',
                  },
                  skipSslCertificateValidation: '={{$credentials.ignoreSSLIssues}}',
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.baseUrl}}',
                  url: '/_xpack?human=false',
              },
          };
      }
  }
  exports.ElasticsearchApi = ElasticsearchApi;
  //# sourceMappingURL=ElasticsearchApi.credentials.js.map

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

  # Elasticsearch node

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

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

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

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

  ## Operations

  * Document
      * Create a document
      * Delete a document
      * Get a document
      * Get all documents
      * Update a document
  * Index
      * Create
      * Delete
      * Get
      * Get All

  ## Templates and examples

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

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

example_workflow:
  {"name":"Elasticsearch Example Workflow","nodes":[{"parameters":{"resource":"document","dynamic_property":null},"id":"pkdqsek37q9ttai7utmbp","name":"Elasticsearch","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"document","options":[{"name":"Document","value":"document"},{"name":"Index","value":"index"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.documentOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.documentFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.indexOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...descriptions_1.indexFields"}]


node_type: n8n-nodes-base.ExecuteCommand
name: ExecuteCommand
display_name: Execute Command
description: Executes a command on the host
category: transform
icon: fa:terminal
code_hash: bf8ab1b48895981a9c275e2cb6b6d840dc705e9e3815ef70f3881402b51fe537
example_parameters: {"executeOnce":true,"command":"example-value"}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:30
updated_at: 2025-06-12 08:58:30
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ExecuteCommand = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const child_process_1 = require("child_process");
  async function execPromise(command) {
      const returnData = {
          error: undefined,
          exitCode: 0,
          stderr: '',
          stdout: '',
      };
      return new Promise((resolve, _reject) => {
          (0, child_process_1.exec)(command, { cwd: process.cwd() }, (error, stdout, stderr) => {
              returnData.stdout = stdout.trim();
              returnData.stderr = stderr.trim();
              if (error) {
                  returnData.error = error;
              }
              resolve(returnData);
          }).on('exit', (code) => {
              returnData.exitCode = code || 0;
          });
      });
  }
  class ExecuteCommand {
      constructor() {
          this.description = {
              displayName: 'Execute Command',
              name: 'executeCommand',
              icon: 'fa:terminal',
              group: ['transform'],
              version: 1,
              description: 'Executes a command on the host',
              defaults: {
                  name: 'Execute Command',
                  color: '#886644',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Execute Once',
                      name: 'executeOnce',
                      type: 'boolean',
                      default: true,
                      description: 'Whether to execute only once instead of once for each entry',
                  },
                  {
                      displayName: 'Command',
                      name: 'command',
                      typeOptions: {
                          rows: 5,
                      },
                      type: 'string',
                      default: '',
                      placeholder: 'echo "test"',
                      description: 'The command to execute',
                      required: true,
                  },
              ],
          };
      }
      async execute() {
          let items = this.getInputData();
          let command;
          const executeOnce = this.getNodeParameter('executeOnce', 0);
          if (executeOnce) {
              items = [items[0]];
          }
          const returnItems = [];
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              try {
                  command = this.getNodeParameter('command', itemIndex);
                  const { error, exitCode, stdout, stderr } = await execPromise(command);
                  if (error !== undefined) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), error.message, { itemIndex });
                  }
                  returnItems.push({
                      json: {
                          exitCode,
                          stderr,
                          stdout,
                      },
                      pairedItem: {
                          item: itemIndex,
                      },
                  });
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnItems.push({
                          json: {
                              error: error.message,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnItems];
      }
  }
  exports.ExecuteCommand = ExecuteCommand;
  //# sourceMappingURL=ExecuteCommand.node.js.map

example_workflow:
  {"name":"Execute Command Example Workflow","nodes":[{"parameters":{"executeOnce":true,"command":"example-value"},"id":"xvfkvoo3hed09n4u3qf4x2c","name":"Execute Command","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Execute Once","name":"executeOnce","type":"boolean","default":true,"description":"Whether to execute only once instead of once for each entry"},{"displayName":"Command","name":"command","type":"string","default":"","required":true,"description":"The command to execute","placeholder":"echo "}]


node_type: n8n-nodes-base.ErrorTrigger
name: ErrorTrigger
display_name: Error Trigger
description: Triggers the workflow when another workflow has an error
category: trigger
icon: fa:bug
code_hash: 433bf91938992037c402b9331a9acbac3ece630c83526bdf8b1b33bde151d98c
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.ErrorTrigger
documentation_title: Error Trigger node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"error-trigger","description":"Templates for error-trigger"}]
required_scopes: []
parameter_schemas: []
example_parameters: {"notice":null,"pollTimes":{"item":[{"mode":"everyMinute"}]}}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:30
updated_at: 2025-06-12 08:58:30
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ErrorTrigger = void 0;
  class ErrorTrigger {
      constructor() {
          this.description = {
              displayName: 'Error Trigger',
              name: 'errorTrigger',
              icon: 'fa:bug',
              group: ['trigger'],
              version: 1,
              description: 'Triggers the workflow when another workflow has an error',
              eventTriggerDescription: '',
              mockManualExecution: true,
              maxNodes: 1,
              defaults: {
                  name: 'Error Trigger',
                  color: '#0000FF',
              },
              inputs: [],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'This node will trigger when there is an error in another workflow, as long as that workflow is set up to do so. <a href="https://docs.n8n.io/integrations/core-nodes/n8n-nodes-base.errortrigger" target="_blank">More info<a>',
                      name: 'notice',
                      type: 'notice',
                      default: '',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const mode = this.getMode();
          if (mode === 'manual' &&
              items.length === 1 &&
              Object.keys(items[0].json).length === 0 &&
              items[0].binary === undefined) {
              const restApiUrl = this.getRestApiUrl();
              const urlParts = restApiUrl.split('/');
              urlParts.pop();
              urlParts.push('execution');
              const id = 231;
              items[0].json = {
                  execution: {
                      id,
                      url: `${urlParts.join('/')}/workflow/1/${id}`,
                      retryOf: '34',
                      error: {
                          message: 'Example Error Message',
                          stack: 'Stacktrace',
                      },
                      lastNodeExecuted: 'Node With Error',
                      mode: 'manual',
                  },
                  workflow: {
                      id: '1',
                      name: 'Example Workflow',
                  },
              };
          }
          return [items];
      }
  }
  exports.ErrorTrigger = ErrorTrigger;
  //# sourceMappingURL=ErrorTrigger.node.js.map

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

  # Error Trigger node

  You can use the Error Trigger node to create error workflows. When another linked workflow fails, this node gets details about the failed workflow and the errors, and runs the error workflow.

  ## Usage

  --8<-- "_snippets/flow-logic/create-set-error-workflow.md"


  Note the following:

  * If a workflow uses the Error Trigger node, you don't have to activate the workflow.
  * If a workflow contains the Error Trigger node, by default, the workflow uses itself as the error workflow.
  * You can't test error workflows when running workflows manually. The Error Trigger only runs when an automatic workflow errors.

  ## Templates and examples

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

  ## Related resources

  You can use the [Stop And Error](/integrations/builtin/core-nodes/n8n-nodes-base.stopanderror.md) node to send custom messages to the Error Trigger.

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

  ## Error data

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

related_resources:
  [{"title":"Stop And Error","url":"/integrations/builtin/core-nodes/n8n-nodes-base.stopanderror.md","type":"documentation"},{"title":"Error workflows","url":"/flow-logic/error-handling.md","type":"documentation"}]

troubleshooting_info:
  [{"issue":"Usage","solution":"--8<-- \"_snippets/flow-logic/create-set-error-workflow.md\""},{"issue":"Error data","solution":"--8<-- \"_snippets/integrations/builtin/core-nodes/error-trigger/error-data.md\""}]

example_workflow:
  {"name":"Error Trigger Example Workflow","nodes":[{"parameters":{"notice":null,"pollTimes":{"item":[{"mode":"everyMinute"}]}},"id":"33s3680x3mub5xg6hvswnn","name":"Error Trigger","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"This node will trigger when there is an error in another workflow, as long as that workflow is set up to do so. <a href=","name":"notice","type":"notice","default":""}]


node_type: n8n-nodes-base.EmailSend
name: EmailSend
display_name: Send Email
description: Sends an email using SMTP protocol
category: output
icon: fa:envelope
code_hash: d76e18808343c4d0a7c35db3213e8e69bdb684cdda5c613e60b184da12c76b4c
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-12 08:58:30
updated_at: 2025-06-12 08:58:30
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.EmailSend = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const EmailSendV1_node_1 = require("./v1/EmailSendV1.node");
  const EmailSendV2_node_1 = require("./v2/EmailSendV2.node");
  class EmailSend extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Send Email',
              name: 'emailSend',
              icon: 'fa:envelope',
              group: ['output'],
              defaultVersion: 2.1,
              description: 'Sends an email using SMTP protocol',
          };
          const nodeVersions = {
              1: new EmailSendV1_node_1.EmailSendV1(baseDescription),
              2: new EmailSendV2_node_1.EmailSendV2(baseDescription),
              2.1: new EmailSendV2_node_1.EmailSendV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.EmailSend = EmailSend;
  //# sourceMappingURL=EmailSend.node.js.map

example_workflow:
  {"name":"Send Email Example Workflow","nodes":[{"parameters":{},"id":"o6q1r14hvcog08wu0xcw1","name":"Send Email","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}


node_type: n8n-nodes-base.ExecuteWorkflow
name: ExecuteWorkflow
display_name: Execute Workflow
description: Execute another workflow
category: transform
icon: fa:sign-in-alt
code_hash: f1565eb6ca9041c9444299bdf264ba10953d71afc7913c5e2ac7c14beead0c9e
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.ExecuteWorkflow
documentation_title: Execute Sub-workflow
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"execute-workflow","description":"Templates for execute-workflow"}]
related_resources: []
required_scopes: []
parameter_schemas: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:30
updated_at: 2025-06-12 08:58:30
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ExecuteWorkflow = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const utilities_1 = require("../../utils/utilities");
  class ExecuteWorkflow {
      constructor() {
          this.description = {
              displayName: 'Execute Workflow',
              name: 'executeWorkflow',
              icon: 'fa:sign-in-alt',
              group: ['transform'],
              version: 1,
              subtitle: '={{"Workflow: " + $parameter["workflowId"]}}',
              description: 'Execute another workflow',
              defaults: {
                  name: 'Execute Workflow',
                  color: '#ff6d5a',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'hidden',
                      noDataExpression: true,
                      default: 'call_workflow',
                      options: [
                          {
                              name: 'Call Another Workflow',
                              value: 'call_workflow',
                          },
                      ],
                  },
                  {
                      displayName: 'Source',
                      name: 'source',
                      type: 'options',
                      options: [
                          {
                              name: 'Database',
                              value: 'database',
                              description: 'Load the workflow from the database by ID',
                          },
                          {
                              name: 'Local File',
                              value: 'localFile',
                              description: 'Load the workflow from a locally saved file',
                          },
                          {
                              name: 'Parameter',
                              value: 'parameter',
                              description: 'Load the workflow from a parameter',
                          },
                          {
                              name: 'URL',
                              value: 'url',
                              description: 'Load the workflow from an URL',
                          },
                      ],
                      default: 'database',
                      description: 'Where to get the workflow to execute from',
                  },
                  {
                      displayName: 'Workflow ID',
                      name: 'workflowId',
                      type: 'string',
                      displayOptions: {
                          show: {
                              source: ['database'],
                          },
                      },
                      default: '',
                      required: true,
                      hint: 'Can be found in the URL of the workflow',
                      description: "Note on using an expression here: if this node is set to run once with all items, they will all be sent to the <em>same</em> workflow. That workflow's ID will be calculated by evaluating the expression for the <strong>first input item</strong>.",
                  },
                  {
                      displayName: 'Workflow Path',
                      name: 'workflowPath',
                      type: 'string',
                      displayOptions: {
                          show: {
                              source: ['localFile'],
                          },
                      },
                      default: '',
                      placeholder: '/data/workflow.json',
                      required: true,
                      description: 'The path to local JSON workflow file to execute',
                  },
                  {
                      displayName: 'Workflow JSON',
                      name: 'workflowJson',
                      type: 'string',
                      typeOptions: {
                          editor: 'json',
                          rows: 10,
                      },
                      displayOptions: {
                          show: {
                              source: ['parameter'],
                          },
                      },
                      default: '\n\n\n',
                      required: true,
                      description: 'The workflow JSON code to execute',
                  },
                  {
                      displayName: 'Workflow URL',
                      name: 'workflowUrl',
                      type: 'string',
                      displayOptions: {
                          show: {
                              source: ['url'],
                          },
                      },
                      default: '',
                      placeholder: 'https://example.com/workflow.json',
                      required: true,
                      description: 'The URL from which to load the workflow from',
                  },
                  {
                      displayName: 'Any data you pass into this node will be output by the Execute Workflow Trigger. <a href="https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflow/" target="_blank">More info</a>',
                      name: 'executeWorkflowNotice',
                      type: 'notice',
                      default: '',
                  },
                  {
                      displayName: 'Mode',
                      name: 'mode',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Run once with all items',
                              value: 'once',
                              description: 'Pass all items into a single execution of the sub-workflow',
                          },
                          {
                              name: 'Run once for each item',
                              value: 'each',
                              description: 'Call the sub-workflow individually for each item',
                          },
                      ],
                      default: 'once',
                  },
              ],
          };
      }
      async execute() {
          const source = this.getNodeParameter('source', 0);
          const mode = this.getNodeParameter('mode', 0, false);
          const items = this.getInputData();
          if (mode === 'each') {
              const returnData = [];
              for (let i = 0; i < items.length; i++) {
                  try {
                      const workflowInfo = await GenericFunctions_1.getWorkflowInfo.call(this, source, i);
                      const workflowResult = await this.executeWorkflow(workflowInfo, [
                          items[i],
                      ]);
                      for (const [outputIndex, outputData] of workflowResult.entries()) {
                          for (const item of outputData) {
                              item.pairedItem = { item: i };
                          }
                          if (returnData[outputIndex] === undefined) {
                              returnData[outputIndex] = [];
                          }
                          returnData[outputIndex].push(...outputData);
                      }
                  }
                  catch (error) {
                      if (this.continueOnFail()) {
                          return [[{ json: { error: error.message }, pairedItem: { item: i } }]];
                      }
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
                          message: `Error executing workflow with item at index ${i}`,
                          description: error.message,
                          itemIndex: i,
                      });
                  }
              }
              return returnData;
          }
          else {
              try {
                  const workflowInfo = await GenericFunctions_1.getWorkflowInfo.call(this, source);
                  const workflowResult = await this.executeWorkflow(workflowInfo, items);
                  const pairedItem = (0, utilities_1.generatePairedItemData)(items.length);
                  for (const output of workflowResult) {
                      for (const item of output) {
                          item.pairedItem = pairedItem;
                      }
                  }
                  return workflowResult;
              }
              catch (error) {
                  const pairedItem = (0, utilities_1.generatePairedItemData)(items.length);
                  if (this.continueOnFail()) {
                      return [[{ json: { error: error.message }, pairedItem }]];
                  }
                  throw error;
              }
          }
      }
  }
  exports.ExecuteWorkflow = ExecuteWorkflow;
  //# sourceMappingURL=ExecuteWorkflow.node.js.map

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

  # Execute Sub-workflow

  Use the Execute Sub-workflow node to run a different workflow on the host machine that runs n8n.

  ## Node parameters

  ### Source

  Select where the node should get the sub-workflow's information from:

  - **Database**: Select this option to load the workflow from the database by ID. You must also enter either:
  	- **From list**: Select the workflow from a list of workflows available to your account.
  	- **Workflow ID**: Enter the ID for the workflow. The URL of the workflow contains the ID after `/workflow/`. For example, if the URL of a workflow is `https://my-n8n-acct.app.n8n.cloud/workflow/abCDE1f6gHiJKL7`, the **Workflow ID** is `abCDE1f6gHiJKL7`.
  - **Local File**: Select this option to load the workflow from a locally saved JSON file. You must also enter:
  	- **Workflow Path**: Enter the path to the local JSON workflow file you want the node to execute.
  - **Parameter**: Select this option to load the workflow from a parameter. You must also enter:
  	- **Workflow JSON**: Enter the JSON code you want the node to execute.
  - **URL**: Select this option to load the workflow from a URL. You must also enter:
  	- **Workflow URL**: Enter the URL you want to load the workflow from.

  ### Workflow Inputs

  If you select a sub-workflow using the **database** and **From list** options, the sub-workflow's input items will automatically display, ready for you to fill in or map values.

  You can optionally remove requested input items, in which case the sub-workflow receives `null` as the item's value. You can also enable **Attempt to convert types** to try to automatically convert data to the sub-workflow item's requested type.

  Input items won't appear if the sub-workflow's Workflow Input Trigger node uses the "Accept all data" input data mode.

  ### Mode

  Use this parameter to control the execution mode for the node. Choose from these options:

  - **Run once with all items**: Pass all input items into a single execution of the node.
  - **Run once for each item**: Execute the node once for each input item in turn.

  ## Node options

  This node includes one option: **Wait for Sub-Workflow Completion**. This lets you control whether the main workflow should wait for the sub-workflow's completion before moving on to the next step (turned on) or whether the main workflow should continue without waiting (turned off).

  ## Templates and examples

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

  ## Set up and use a sub-workflow

  This section walks through setting up both the parent workflow and sub-workflow.

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


  ## How data passes between workflows

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

workflow_examples:
  [{"name":"ask_a_human","workflow":{"name":"Ask a human","nodes":[{"parameters":{},"id":"a60c8572-56c1-4bf3-8352-a6419a475887","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","typeVersion":1.1,"position":[900,760]},{"parameters":{"name":"dont_know_tool","description":"Use this tool if you don't know the answer to the user's question, or if you're not very confident about your answer.","workflowId":"={{ $workflow.id}}","fields":{"values":[{"name":"chatInput","stringValue":"={{ $('Chat Trigger').item.json.chatInput }}"}]}},"id":"b4f2e26c-903b-46b8-bd8b-110fd64de9e4","name":"Not sure?","type":"@n8n/n8n-nodes-langchain.toolWorkflow","typeVersion":1,"position":[1120,760]},{"parameters":{},"id":"951cc691-b422-4ce6-901f-b7feb3afd1ad","name":"Execute Workflow Trigger","type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1,"position":[540,1360]},{"parameters":{"content":"### Sub-workflow: Custom tool\nThe agent above can call this workflow. It checks if the user has supplied an email address. If they haven't it prompts them to provide one. If they have, it messages a customer support channel for help.","height":775.3931210698682,"width":1118.3459011229047,"color":7},"id":"194ba9c0-e256-449a-8da7-ac5339123a99","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[500,1020],"typeVersion":1},{"parameters":{"content":"### Main workflow: AI agent using custom tool","height":486.5625,"width":927.5,"color":7},"id":"38c6b363-45a7-4e72-9e40-8c0df3cc480f","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[500,460],"typeVersion":1},{"parameters":{"content":"**This tool calls the sub-workflow below**","height":179.21380662202682,"width":197.45572294791873,"color":5},"id":"0389315b-e48d-4b00-b9a1-899302b1b094","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1060,700],"typeVersion":1},{"parameters":{"content":"**Set your credentials**","height":213.44323866265472,"width":150,"color":2},"id":"fb11064a-4cf5-4110-9e39-af24a3225164","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[700,680]},{"parameters":{"content":"**Set your credentials and Slack details**","height":250.57252651663197,"width":178.0499248677781,"color":2},"id":"d689021d-0a46-4dff-a01a-0b01ecdd198b","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[1020,1180]},{"parameters":{"content":"## Try it out\n\nSelect **Chat** at the bottom and enter:\n\n_Hi! Please respond to this as if you don't know the answer to my query._","height":214.8397420554627,"width":185.9375,"color":4},"id":"0926cd61-c0b8-4bae-ae65-9afd130d17cd","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[340,520],"typeVersion":1},{"parameters":{"content":"## Next steps\n\nLearn more about [Advanced AI in n8n](https://docs.n8n.io/advanced-ai/)","height":144.50520156238127},"id":"cde69dfe-252e-4a05-8d56-fa79431df5d8","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[1580,1600]},{"parameters":{},"id":"927b775a-47f6-4067-a1a5-5f13dea28e45","name":"Chat Trigger","type":"@n8n/n8n-nodes-langchain.chatTrigger","typeVersion":1,"position":[600,520],"webhookId":"785e0c0c-12e5-4249-9abe-47bb131975cb"},{"parameters":{"jsCode":"response = {\"response\":\"I'm sorry I don't know the answer. Please repeat your question and include your email address so I can request help.\"};\nreturn response;"},"id":"971e7b90-c2d8-4292-9da8-732d7d399f04","name":"Prompt the user to provide an email","type":"n8n-nodes-base.code","typeVersion":2,"position":[1060,1520]},{"parameters":{"jsCode":"response = {\"response\": \"Thank you for getting in touch. I've messaged a human to help.\"}\nreturn response;"},"id":"6f5a21b3-c145-46c8-8e69-660100c4a6fc","name":"Confirm that we've messaged a human","type":"n8n-nodes-base.code","typeVersion":2,"position":[1300,1260]},{"parameters":{"options":{"systemMessage":"Try to answer the user's question. When you can't answer, or you're not confident of the answer, use the appropriate tool. When you use the dont_know_tool, respond with the message from the tool."}},"id":"8b17da5e-e392-4028-91b0-bc02d34e46ed","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","typeVersion":1.2,"position":[820,520]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"5e21e7c5-db60-4111-bb17-c289ae0fc159","leftValue":"={{ $('Execute Workflow Trigger').item.json.chatInput }}","rightValue":"/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+)/gi","operator":{"type":"string","operation":"regex"}}],"combinator":"and"},"options":{}},"id":"990ecd3b-6aa0-4b17-8d01-d606b9164fa8","name":"Check if user has provided email","type":"n8n-nodes-base.if","typeVersion":2,"position":[760,1360]},{"parameters":{"select":"channel","channelId":{"__rl":true,"value":"","mode":"name"},"text":"={{ \"A user had a question the bot couldn't answer. Here's their message: \" + $('Execute Workflow Trigger').item.json.chatInput }}","otherOptions":{}},"id":"d14da0ae-06ca-422b-b5b6-e7759e74c787","name":"Message Slack for help","type":"n8n-nodes-base.slack","typeVersion":2.1,"position":[1060,1260]},{"parameters":{"model":"gpt-4","options":{"temperature":0.2}},"id":"278391c7-6945-495e-a4f1-74fb8fcc3549","name":"GPT4","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","typeVersion":1,"position":[740,740]}],"pinData":{},"connections":{"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Not sure?":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Check if user has provided email","type":"main","index":0}]]},"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Check if user has provided email":{"main":[[{"node":"Message Slack for help","type":"main","index":0}],[{"node":"Prompt the user to provide an email","type":"main","index":0}]]},"Message Slack for help":{"main":[[{"node":"Confirm that we've messaged a human","type":"main","index":0}]]},"GPT4":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.executeWorkflowTrigger","version":1,"parameters":{},"position":[540,1360]}],"connections":{"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Not sure?":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Check if user has provided email","type":"main","index":0}]]},"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Check if user has provided email":{"main":[[{"node":"Message Slack for help","type":"main","index":0}],[{"node":"Prompt the user to provide an email","type":"main","index":0}]]},"Message Slack for help":{"main":[[{"node":"Confirm that we've messaged a human","type":"main","index":0}]]},"GPT4":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}},"source":"docs/_workflows/advanced-ai/examples/ask_a_human.json"},{"name":"chat_with_google_sheets_docs_version","workflow":{"name":"Chat with Google Sheets (docs version)","nodes":[{"parameters":{},"id":"e96a5e41-f0d6-49c1-977e-ff724a857212","name":"Execute Workflow Trigger","type":"n8n-nodes-base.executeWorkflowTrigger","position":[540,1240],"typeVersion":1},{"parameters":{"content":"### Sub-workflow: Custom tool\nThe agent above can call this workflow. It returns three different types of data from the Google Sheet, which can be used together for more complex queries without returning the whole sheet (which might be too big for GPT to handle).","height":612.0936015224503,"width":1449.2963504228514,"color":7},"id":"67facef0-e9c6-4280-8232-78f654b420d5","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[461.9740563285368,970.616715060075],"typeVersion":1},{"parameters":{"content":"### Main workflow: AI agent using custom tool","height":486.5625,"width":927.5,"color":7},"id":"bc448102-954b-451e-9bf7-bcadbc53bdbc","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[460,460],"typeVersion":1},{"parameters":{"content":"## Try it out\n\nSelect **Chat** at the bottom and enter:\n\n_Which is our biggest customer?_","height":183.85014518022527,"width":185.9375,"color":4},"id":"afb2da2f-8da2-4ee8-bff9-55a99eeecc5c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[300,540],"typeVersion":1},{"parameters":{},"id":"5d56d128-9a83-45ee-a34c-bc1190d59322","name":"Chat Trigger","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[600,560],"webhookId":"e3f23177-c7c1-417b-a513-1c1090dda0a2","typeVersion":1},{"parameters":{"authentication":"serviceAccount","documentId":{"__rl":true,"mode":"url","value":"={{ $json.sheetUrl }}"},"sheetName":{"__rl":true,"mode":"url","value":"={{ $json.sheetUrl }}"},"options":{}},"id":"3c0e4b48-a27b-472f-948e-9aa001c49149","name":"Get Google sheet contents","type":"n8n-nodes-base.googleSheets","position":[980,1240],"typeVersion":4.2},{"parameters":{"fields":{"values":[{"name":"sheetUrl"}]},"options":{}},"id":"67f9c172-e70f-4a0f-afd3-513cfeae09db","name":"Set Google Sheet URL","type":"n8n-nodes-base.set","position":[760,1240],"typeVersion":3.2},{"parameters":{"fields":{"values":[{"name":"response","stringValue":"={{ Object.keys($json) }}"}]},"include":"none","options":{}},"id":"d49223eb-2927-4ddd-bd2c-cd439f927341","name":"Get column names","type":"n8n-nodes-base.set","position":[1440,1060],"executeOnce":true,"typeVersion":3.2},{"parameters":{"jsCode":"return {\n  'response': JSON.stringify($input.all().map(x => x.json))\n}"},"id":"37ceba7a-1f0b-4de7-ae4a-d29a18dabaf6","name":"Prepare output","type":"n8n-nodes-base.code","position":[1720,1240],"typeVersion":2},{"parameters":{"name":"list_columns_tool","description":"=### List all column names in customer data\nThis is useful to find out what data is available for each customer. Returns a JSON array containing all the column names.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"column_names"}]}},"id":"94516eb1-89fc-4d3f-8000-d0fa43cd71cd","name":"List columns tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[940,780],"typeVersion":1},{"parameters":{"name":"get_customer_tool","description":"=### Get all columns for a given customer\nTo use this mode, pass the row number of the customer. Returns a JSON object with all the column names and their values.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"row"}]}},"id":"006745a1-3df7-4de9-9483-c6e133272c55","name":"Get customer tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[1220,780],"typeVersion":1},{"parameters":{},"id":"c3d20569-1374-4f8d-8779-23b98952d124","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[800,780],"typeVersion":1.1},{"parameters":{"name":"column_values_tool","description":"=### Get the specified column value for all customers\nThis is useful if you want to find out which customers have a certain value for a given column. Returns an array of JSON objects, one per customer. Each JSON object includes the column being requested, plus the row_number column. (The row_number column can be used to request the full customer data in a second step.). To use this mode, pass the name of the column to fetch.\n\nYou may want to call the 'list columns' tool first to find out which columns you could be fetching.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"column_values"}]}},"id":"3a370ae9-eaf8-4e84-948b-848c461ac9eb","name":"Get column values tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[1080,780],"typeVersion":1},{"parameters":{"text":"={{ $json.chatInput }}","options":{"maxIterations":10}},"id":"8f2a4854-2177-4ac8-9501-fa36cf2a3d73","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[820,560],"typeVersion":1.1},{"parameters":{"content":"**These tools all call the sub-workflow below**","height":179.21380662202682,"width":432.3271051132649,"color":5},"id":"2576563b-a104-4d99-b3c8-b53bff4c740c","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[900,740.8693557231958],"typeVersion":1},{"parameters":{"content":"**Change the URL of the Google Sheet**","height":226.64416053838073,"width":179.99762227826224,"color":2},"id":"5b623d9e-e188-403d-a702-9ece6172a487","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[723,1172],"typeVersion":1},{"parameters":{"model":"gpt-4","options":{"temperature":0}},"id":"2b8c8a67-a4df-4f5c-8c13-3cb2d25d2c5f","name":"GPT4 Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[660,780],"typeVersion":1},{"parameters":{"content":"**Set your credentials**","height":171,"width":150,"color":2},"id":"f39d0c9b-4055-4331-83c8-3dbffb43478e","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[620,720]},{"parameters":{"content":"**Set your credentials**","height":237,"width":176,"color":2},"id":"a8e09ef8-4dc6-4918-9194-047de402a8fa","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[940,1172]},{"parameters":{"content":"## Next steps\n\nLearn more about [Advanced AI in n8n](https://docs.n8n.io/advanced-ai/)","height":126.0084096222716,"width":291.1204551358572},"id":"a391dfb1-f408-4498-99cd-d35a258d6c9a","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[1740,1540]},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"column_names","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"col names"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"9fe58592-72e2-4379-9bdb-10da19c8218b","leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"column_values","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"col values"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"c1836f93-7874-43a4-98ff-cc487b276600","leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"row","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"rows"}]},"options":{}},"id":"907deea9-26cc-427e-93fc-52ce6b67e5e1","name":"Check operations","type":"n8n-nodes-base.switch","typeVersion":3,"position":[1220,1240]},{"parameters":{"fields":{"values":[{"name":"={{ $('Execute Workflow Trigger').item.json.query }}","stringValue":"={{ $json[$('Execute Workflow Trigger').item.json.query] }}"},{"name":"row_number","stringValue":"={{ $json.row_number }}"}]},"include":"none","options":{}},"id":"f2ebcae6-3cfb-4862-a927-dc66bd24f197","name":"Prepare column data","type":"n8n-nodes-base.set","position":[1440,1240],"typeVersion":3.2},{"parameters":{"conditions":{"options":{"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"bf712098-97e4-42cb-8e08-2ee32d19d3e7","operator":{"type":"number","operation":"equals"},"leftValue":"={{ $json.row_number }}","rightValue":"={{ $('Execute Workflow Trigger').item.json.query }}"}]},"options":{"looseTypeValidation":true}},"id":"f40acb04-ef06-4670-b8b1-86b04f066af8","name":"Filter out other rows","type":"n8n-nodes-base.filter","position":[1440,1420],"typeVersion":2}],"pinData":{},"connections":{"GPT4 Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Get column names":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Get customer tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"List columns tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Set Google Sheet URL":{"main":[[{"node":"Get Google sheet contents","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Get column values tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Set Google Sheet URL","type":"main","index":0}]]},"Get Google sheet contents":{"main":[[{"node":"Check operations","type":"main","index":0}]]},"Check operations":{"main":[[{"node":"Get column names","type":"main","index":0}],[{"node":"Prepare column data","type":"main","index":0}],[{"node":"Filter out other rows","type":"main","index":0}]]},"Prepare column data":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Filter out other rows":{"main":[[{"node":"Prepare output","type":"main","index":0}]]}}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.executeWorkflowTrigger","version":1,"parameters":{},"position":[540,1240]}],"connections":{"GPT4 Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Get column names":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Get customer tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"List columns tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Set Google Sheet URL":{"main":[[{"node":"Get Google sheet contents","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Get column values tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Set Google Sheet URL","type":"main","index":0}]]},"Get Google sheet contents":{"main":[[{"node":"Check operations","type":"main","index":0}]]},"Check operations":{"main":[[{"node":"Get column names","type":"main","index":0}],[{"node":"Prepare column data","type":"main","index":0}],[{"node":"Filter out other rows","type":"main","index":0}]]},"Prepare column data":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Filter out other rows":{"main":[[{"node":"Prepare output","type":"main","index":0}]]}},"source":"docs/_workflows/advanced-ai/examples/chat_with_google_sheets_docs_version.json"},{"name":"let_your_ai_call_an_api","workflow":{"name":"Let your AI call an API","nodes":[{"parameters":{},"id":"35ce49a9-eda1-4da5-a6cb-39a39680111b","name":"Execute Workflow Trigger","type":"n8n-nodes-base.executeWorkflowTrigger","position":[520,1140],"typeVersion":1},{"parameters":{"content":"### Sub-workflow: Custom tool\nThe agent above can call this workflow. It calls an example API called \"Bored API\" and returns a string with an activity idea.","height":775.3931210698682,"width":1180.0825159534493,"color":7},"id":"ec6e261b-922f-401c-9392-12ff73488a5f","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[460,960],"typeVersion":1},{"parameters":{"content":"### Main workflow: AI agent using custom tool","height":486.5625,"width":927.5,"color":7},"id":"25780e87-0ae0-4bee-9582-75f98bf66635","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[460,460],"typeVersion":1},{"parameters":{},"id":"f262f04b-964c-47c0-b7dc-a86b82b0184b","name":"Chat Trigger","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[600,560],"webhookId":"e3f23177-c7c1-417b-a513-1c1090dda0a2","typeVersion":1},{"parameters":{},"id":"29678c05-9a48-41ec-9c5c-af36ee0d7fc6","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[860,780],"typeVersion":1.1},{"parameters":{"content":"**This tool calls the sub-workflow below**","height":179.21380662202682,"width":197.45572294791873,"color":5},"id":"e078f88b-489c-42ea-9544-6bdaeae213a0","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1020,720],"typeVersion":1},{"parameters":{"content":"**Set your credentials**","height":171,"width":150,"color":2},"id":"1d1d1a4e-0d1d-4094-81c7-e01f2674df0d","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[620,720]},{"parameters":{"content":"**Set your credentials**","height":170.10898979087855,"width":152.85917676941358,"color":2},"id":"8c83d554-bf1f-4b3c-abb9-a6bb76846698","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[880,1540.2624287261167]},{"parameters":{"name":"activity_tool","description":"=Suggest an activity for a person to do. Use this tool if someone is bored, or asking for ideas of things to do.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"chatInput","stringValue":"={{ $('Chat Trigger').item.json.chatInput }}"}]}},"id":"82a3c606-0d7a-4b45-aae7-df35525615f7","name":"Activity tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[1080,780],"typeVersion":1},{"parameters":{"text":"={{ $json.chatInput }}","options":{"maxIterations":10}},"id":"716dea0d-a987-4cf7-ae4a-bf0f7c7d7da9","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[820,560],"typeVersion":1.1},{"parameters":{},"id":"f469fba8-07ae-4c79-a79c-2c49946d94e2","name":"Auto-fixing Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserAutofixing","typeVersion":1,"position":[920,1380]},{"parameters":{"content":"**Set your credentials**","height":189.79768930311286,"width":150,"color":2},"id":"e6d252d3-d78e-4827-b911-0528c3b80794","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[648.9502850955331,1340]},{"parameters":{"model":"gpt-4","options":{}},"id":"f65054a9-771c-47f8-94cc-4ed766f89d19","name":"GPT4 Model 1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[660,780],"typeVersion":1},{"parameters":{"model":"gpt-4","options":{}},"id":"94c2a6d8-cab9-48c2-8801-4306f0957f50","name":"GPT4 Model 2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","typeVersion":1,"position":[700,1420]},{"parameters":{"model":"gpt-4","options":{}},"id":"5f423800-2eaf-43f5-bd59-dc1212cb55ad","name":"GPT4 Model 3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","typeVersion":1,"position":[920,1600]},{"parameters":{"content":"## Try it out\n\nSelect **Chat** at the bottom and enter:\n\n_Hi! Please suggest something to do. I feel like learning something new._","height":214.8397420554627,"width":185.9375,"color":4},"id":"8ba60ef6-c375-41d9-bf79-1f19f1495adb","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[300,540],"typeVersion":1},{"parameters":{"content":"## Next steps\n\nLearn more about [Advanced AI in n8n](https://docs.n8n.io/advanced-ai/)","height":144.50520156238127},"id":"4bbd5942-4f2a-4a9a-a26c-61f95ad57549","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[1500,1540]},{"parameters":{"jsonSchema":"{\n  \"type\": \"object\",\n  \"properties\": {\n    \"type\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"data\": {\n          \"enum\": [\"education\", \"recreational\",\"social\",\"diy\",\"charity\",\"cooking\",\"relaxation\",\"music\",\"busywork\"]\n        }\n      }\n    },\n    \"participants\": {\n      \"type\": \"number\"\n    }\n  }\n}"},"id":"a50c7858-b0fd-44d6-898d-452ffc5cbd72","name":"Structure as JSON","type":"@n8n/n8n-nodes-langchain.outputParserStructured","typeVersion":1,"position":[1120,1520]},{"parameters":{"url":"http://www.boredapi.com/api/activity/","sendQuery":true,"queryParameters":{"parameters":[{"name":"type","value":"={{ $json.output.type.data }}"},{"name":"participants","value":"={{ $json.output.participants }}"}]},"options":{}},"id":"340c2536-6e79-4af6-9cd0-5cbf6eae1983","name":"Call the API","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[1120,1140]},{"parameters":{"prompt":"={{ $('Execute Workflow Trigger').item.json.chatInput }}"},"id":"d7d5455c-2e46-4896-853c-6b527e9403e4","name":"Work out activity type and number of people","type":"@n8n/n8n-nodes-langchain.chainLlm","typeVersion":1.3,"position":[740,1140]},{"parameters":{"assignments":{"assignments":[{"id":"e37e64f6-64e7-4fbd-9ea1-e9d3ef99b39c","name":"response","value":"={{ $json.activity }}","type":"string"}]},"options":{}},"id":"83f9ac05-4583-4cc4-bcc8-29ae450c95cb","name":"Set 'response' value","type":"n8n-nodes-base.set","typeVersion":3.3,"position":[1340,1140]}],"pinData":{},"connections":{"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Work out activity type and number of people","type":"main","index":0}]]},"Activity tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Auto-fixing Output Parser":{"ai_outputParser":[[{"node":"Work out activity type and number of people","type":"ai_outputParser","index":0}]]},"GPT4 Model 1":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"GPT4 Model 2":{"ai_languageModel":[[{"node":"Work out activity type and number of people","type":"ai_languageModel","index":0}]]},"GPT4 Model 3":{"ai_languageModel":[[{"node":"Auto-fixing Output Parser","type":"ai_languageModel","index":0}]]},"Structure as JSON":{"ai_outputParser":[[{"node":"Auto-fixing Output Parser","type":"ai_outputParser","index":0}]]},"Call the API":{"main":[[{"node":"Set 'response' value","type":"main","index":0}]]},"Work out activity type and number of people":{"main":[[{"node":"Call the API","type":"main","index":0}]]}}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.executeWorkflowTrigger","version":1,"parameters":{},"position":[520,1140]}],"connections":{"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Work out activity type and number of people","type":"main","index":0}]]},"Activity tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Auto-fixing Output Parser":{"ai_outputParser":[[{"node":"Work out activity type and number of people","type":"ai_outputParser","index":0}]]},"GPT4 Model 1":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"GPT4 Model 2":{"ai_languageModel":[[{"node":"Work out activity type and number of people","type":"ai_languageModel","index":0}]]},"GPT4 Model 3":{"ai_languageModel":[[{"node":"Auto-fixing Output Parser","type":"ai_languageModel","index":0}]]},"Structure as JSON":{"ai_outputParser":[[{"node":"Auto-fixing Output Parser","type":"ai_outputParser","index":0}]]},"Call the API":{"main":[[{"node":"Set 'response' value","type":"main","index":0}]]},"Work out activity type and number of people":{"main":[[{"node":"Call the API","type":"main","index":0}]]}},"source":"docs/_workflows/advanced-ai/examples/let_your_ai_call_an_api.json"}]

troubleshooting_info:
  [{"issue":"Source","solution":"Select where the node should get the sub-workflow's information from:"},{"issue":"Workflow Inputs","solution":"If you select a sub-workflow using the **database** and **From list** options, the sub-workflow's input items will automatically display, ready for you to fill in or map values."},{"issue":"Mode","solution":"Use this parameter to control the execution mode for the node. Choose from these options:"},{"issue":"Node options","solution":"This node includes one option: **Wait for Sub-Workflow Completion**. This lets you control whether the main workflow should wait for the sub-workflow's completion before moving on to the next step (turned on) or whether the main workflow should continue without waiting (turned off)."},{"issue":"Set up and use a sub-workflow","solution":"This section walks through setting up both the parent workflow and sub-workflow."},{"issue":"How data passes between workflows","solution":"--8<-- \"_snippets/flow-logic/subworkflow-data-flow.md\""}]

node_connections:
  [{"fromNode":"Simple Memory","toNode":"AI Agent","connectionType":"ai_memory"},{"fromNode":"Not sure?","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Execute Workflow Trigger","toNode":"Check if user has provided email","connectionType":"main"},{"fromNode":"Chat Trigger","toNode":"AI Agent","connectionType":"main"},{"fromNode":"Check if user has provided email","toNode":"Message Slack for help","connectionType":"main"},{"fromNode":"Check if user has provided email","toNode":"Prompt the user to provide an email","connectionType":"main"},{"fromNode":"Message Slack for help","toNode":"Confirm that we've messaged a human","connectionType":"main"},{"fromNode":"GPT4","toNode":"AI Agent","connectionType":"ai_languageModel"},{"fromNode":"GPT4 Model","toNode":"AI Agent","connectionType":"ai_languageModel"},{"fromNode":"Get column names","toNode":"Prepare output","connectionType":"main"},{"fromNode":"Get customer tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"List columns tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Set Google Sheet URL","toNode":"Get Google sheet contents","connectionType":"main"},{"fromNode":"Get column values tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Execute Workflow Trigger","toNode":"Set Google Sheet URL","connectionType":"main"},{"fromNode":"Get Google sheet contents","toNode":"Check operations","connectionType":"main"},{"fromNode":"Check operations","toNode":"Get column names","connectionType":"main"},{"fromNode":"Check operations","toNode":"Prepare column data","connectionType":"main"},{"fromNode":"Check operations","toNode":"Filter out other rows","connectionType":"main"},{"fromNode":"Prepare column data","toNode":"Prepare output","connectionType":"main"},{"fromNode":"Filter out other rows","toNode":"Prepare output","connectionType":"main"},{"fromNode":"Execute Workflow Trigger","toNode":"Work out activity type and number of people","connectionType":"main"},{"fromNode":"Activity tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Auto-fixing Output Parser","toNode":"Work out activity type and number of people","connectionType":"ai_outputParser"},{"fromNode":"GPT4 Model 1","toNode":"AI Agent","connectionType":"ai_languageModel"},{"fromNode":"GPT4 Model 2","toNode":"Work out activity type and number of people","connectionType":"ai_languageModel"},{"fromNode":"GPT4 Model 3","toNode":"Auto-fixing Output Parser","connectionType":"ai_languageModel"},{"fromNode":"Structure as JSON","toNode":"Auto-fixing Output Parser","connectionType":"ai_outputParser"},{"fromNode":"Call the API","toNode":"Set 'response' value","connectionType":"main"},{"fromNode":"Work out activity type and number of people","toNode":"Call the API","connectionType":"main"}]

example_workflow:
  {"name":"Execute Workflow Example Workflow","nodes":[{"parameters":{"operation":"call_workflow","source":"database","workflowId":"example-value","workflowPath":"example-value","workflowJson":"\\n\\n\\n","workflowUrl":"https://example.com","executeWorkflowNotice":null,"mode":"once"},"id":"lajnxxv6yio5i4e5gsybkm","name":"Execute Workflow","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

example_parameters:
  {"operation":"call_workflow","source":"database","workflowId":"example-value","workflowPath":"example-value","workflowJson":"\\n\\n\\n","workflowUrl":"https://example.com","executeWorkflowNotice":null,"mode":"once"}

properties_schema:
  [{"displayName":"Operation","name":"operation","type":"hidden","default":"call_workflow"},{"displayName":"Source","name":"source","type":"options","default":"database","description":"Load the workflow from the database by ID","options":[{"name":"Database","value":"database","description":"Load the workflow from the database by ID"},{"name":"Local File","value":"localFile","description":"Load the workflow from a locally saved file"},{"name":"Parameter","value":"parameter","description":"Load the workflow from a parameter"},{"name":"URL","value":"url","description":"Load the workflow from an URL"}]},{"displayName":"Workflow ID","name":"workflowId","type":"string","default":"","required":true,"description":"Note on using an expression here: if this node is set to run once with all items, they will all be sent to the <em>same</em> workflow. That workflow"},{"displayName":"Workflow Path","name":"workflowPath","type":"string","default":"","required":true,"description":"The path to local JSON workflow file to execute","placeholder":"/data/workflow.json"},{"displayName":"Workflow JSON","name":"workflowJson","type":"string","default":"\\n\\n\\n","required":true,"description":"The workflow JSON code to execute"},{"displayName":"Workflow URL","name":"workflowUrl","type":"string","default":"","required":true,"description":"The URL from which to load the workflow from","placeholder":"https://example.com/workflow.json"},{"displayName":"Any data you pass into this node will be output by the Execute Workflow Trigger. <a href=","name":"executeWorkflowNotice","type":"notice","default":""},{"displayName":"Mode","name":"mode","type":"options","default":"once","description":"Pass all items into a single execution of the sub-workflow","options":[{"name":"Run once with all items","value":"once","description":"Pass all items into a single execution of the sub-workflow"},{"name":"Run once for each item","value":"each","description":"Call the sub-workflow individually for each item"}]}]


node_type: n8n-nodes-base.Emelia
name: Emelia
display_name: Emelia
description: Consume the Emelia API
category: input
icon: file:emelia.svg
code_hash: 6766c6cf35962c2279f103df5e159989ed84476fefdc6612dc6e482526b19271
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Emelia
documentation_title: Emelia node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"emelia","description":"Templates for emelia"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"campaign","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:58:30
updated_at: 2025-06-12 08:58:30
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.Emelia = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const CampaignDescription_1 = require("./CampaignDescription");
  const ContactListDescription_1 = require("./ContactListDescription");
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
  class Emelia {
      constructor() {
          this.description = {
              displayName: 'Emelia',
              name: 'emelia',
              icon: 'file:emelia.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Emelia API',
              defaults: {
                  name: 'Emelia',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'emeliaApi',
                      required: true,
                      testedBy: 'emeliaApiTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Campaign',
                              value: 'campaign',
                          },
                          {
                              name: 'Contact List',
                              value: 'contactList',
                          },
                      ],
                      default: 'campaign',
                      required: true,
                  },
                  ...CampaignDescription_1.campaignOperations,
                  ...CampaignDescription_1.campaignFields,
                  ...ContactListDescription_1.contactListOperations,
                  ...ContactListDescription_1.contactListFields,
              ],
          };
          this.methods = {
              credentialTest: {
                  emeliaApiTest: GenericFunctions_1.emeliaApiTest,
              },
              loadOptions: {
                  async getCampaigns() {
                      return GenericFunctions_1.loadResource.call(this, 'campaign');
                  },
                  async getContactLists() {
                      return GenericFunctions_1.loadResource.call(this, 'contactList');
                  },
              },
          };
      }
      async execute() {
          var _a, _b;
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'campaign') {
                      if (operation === 'addContact') {
                          const contact = {
                              email: this.getNodeParameter('contactEmail', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (!(0, isEmpty_1.default)(additionalFields)) {
                              Object.assign(contact, additionalFields);
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = ((_a = additionalFields.customFieldsUi) === null || _a === void 0 ? void 0 : _a.customFieldsValues) || [];
                              const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldName}`]: value.value }), {});
                              Object.assign(contact, data);
                              delete contact.customFieldsUi;
                          }
                          const responseData = await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              query: `
  									mutation AddContactToCampaignHook($id: ID!, $contact: JSON!) {
  										addContactToCampaignHook(id: $id, contact: $contact)
  								}`,
                              operationName: 'AddContactToCampaignHook',
                              variables: {
                                  id: this.getNodeParameter('campaignId', i),
                                  contact,
                              },
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({
                              contactId: responseData.data.addContactToCampaignHook,
                          }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'create') {
                          const responseData = await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              operationName: 'createCampaign',
                              query: `
  									mutation createCampaign($name: String!) {
  										createCampaign(name: $name) {
  											_id
  											name
  											status
  											createdAt
  											provider
  											startAt
  											estimatedEnd
  										}
  									}`,
                              variables: {
                                  name: this.getNodeParameter('campaignName', i),
                              },
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData.data.createCampaign), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'get') {
                          const responseData = await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              query: `
  									query campaign($id: ID!){
  										campaign(id: $id){
  											_id
  											name
  											status
  											createdAt
  											schedule{
  												dailyContact
  												dailyLimit
  												minInterval
  												maxInterval
  												trackLinks
  												trackOpens
  												timeZone
  												days
  												start
  												end
  												eventToStopMails
  											}
  											provider
  											startAt
  											recipients{
  												total_count
  											}
  											estimatedEnd
  										}
  									}`,
                              operationName: 'campaign',
                              variables: {
                                  id: this.getNodeParameter('campaignId', i),
                              },
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData.data.campaign), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              query: `
  									query all_campaigns {
  										all_campaigns {
  											_id
  											name
  											status
  											createdAt
  											stats {
  												mailsSent
  												uniqueOpensPercent
  												opens
  												linkClickedPercent
  												repliedPercent
  												bouncedPercent
  												unsubscribePercent
  												progressPercent
  											}
  										}
  									}`,
                              operationName: 'all_campaigns',
                          });
                          let campaigns = responseData.data.all_campaigns;
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              campaigns = campaigns.slice(0, limit);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(campaigns), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'pause') {
                          await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              query: `
  									mutation pauseCampaign($id: ID!) {
  										pauseCampaign(id: $id)
  									}`,
                              operationName: 'pauseCampaign',
                              variables: {
                                  id: this.getNodeParameter('campaignId', i),
                              },
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'start') {
                          await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              query: `
  									mutation startCampaign($id: ID!) {
  										startCampaign(id: $id)
  									}`,
                              operationName: 'startCampaign',
                              variables: {
                                  id: this.getNodeParameter('campaignId', i),
                              },
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'duplicate') {
                          const options = this.getNodeParameter('options', i);
                          const variables = {
                              fromId: this.getNodeParameter('campaignId', i),
                              name: this.getNodeParameter('campaignName', i),
                              copySettings: true,
                              copyMails: true,
                              copyContacts: false,
                              copyProvider: true,
                              ...options,
                          };
                          const { data: { duplicateCampaign }, } = await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              query: `
  									mutation duplicateCampaign(
  										$fromId: ID!
  										$name: String!
  										$copySettings: Boolean!
  										$copyMails: Boolean!
  										$copyContacts: Boolean!
  										$copyProvider: Boolean!
  									) {
  										duplicateCampaign(
  											fromId: $fromId
  											name: $name
  											copySettings: $copySettings
  											copyMails: $copyMails
  											copyContacts: $copyContacts
  											copyProvider: $copyProvider
  										)
  									}`,
                              operationName: 'duplicateCampaign',
                              variables,
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ _id: duplicateCampaign }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
                  else if (resource === 'contactList') {
                      if (operation === 'add') {
                          const contact = {
                              email: this.getNodeParameter('contactEmail', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (!(0, isEmpty_1.default)(additionalFields)) {
                              Object.assign(contact, additionalFields);
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = ((_b = additionalFields.customFieldsUi) === null || _b === void 0 ? void 0 : _b.customFieldsValues) || [];
                              const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldName}`]: value.value }), {});
                              Object.assign(contact, data);
                              delete contact.customFieldsUi;
                          }
                          const responseData = await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              query: `
  									mutation AddContactsToListHook($id: ID!, $contact: JSON!) {
  										addContactsToListHook(id: $id, contact: $contact)
  									}`,
                              operationName: 'AddContactsToListHook',
                              variables: {
                                  id: this.getNodeParameter('contactListId', i),
                                  contact,
                              },
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ contactId: responseData.data.addContactsToListHook }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else if (operation === 'getAll') {
                          const responseData = await GenericFunctions_1.emeliaGraphqlRequest.call(this, {
                              query: `
  									query contact_lists{
  										contact_lists{
  											_id
  											name
  											contactCount
  											fields
  											usedInCampaign
  										}
  									}`,
                              operationName: 'contact_lists',
                          });
                          let contactLists = responseData.data.contact_lists;
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              contactLists = contactLists.slice(0, limit);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(contactLists), { 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.Emelia = Emelia;
  //# sourceMappingURL=Emelia.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.EmeliaApi = void 0;
  class EmeliaApi {
      constructor() {
          this.name = 'emeliaApi';
          this.displayName = 'Emelia API';
          this.documentationUrl = 'emelia';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
      }
  }
  exports.EmeliaApi = EmeliaApi;
  //# sourceMappingURL=EmeliaApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.EmeliaApi = void 0;
  class EmeliaApi {
      constructor() {
          this.name = 'emeliaApi';
          this.displayName = 'Emelia API';
          this.documentationUrl = 'emelia';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
      }
  }
  exports.EmeliaApi = EmeliaApi;
  //# sourceMappingURL=EmeliaApi.credentials.js.map

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

  # Emelia node

  Use the Emelia node to automate work in Emelia, and integrate Emelia with other applications. n8n has built-in support for a wide range of Emelia features, including creating campaigns, and adding contacts to a list. 

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

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

  ## Operations

  * Campaign
      * Add Contact
      * Create
      * Get
      * Get All
      * Pause
      * Start
  * Contact List
      * Add
      * Get All

  ## Templates and examples

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

example_workflow:
  {"name":"Emelia Example Workflow","nodes":[{"parameters":{"resource":"campaign","dynamic_property":null},"id":"fvr3apjqysjiw4lz8eiv","name":"Emelia","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"campaign","required":true,"options":[{"name":"Campaign","value":"campaign"},{"name":"Contact List","value":"contactList"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CampaignDescription_1.campaignOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CampaignDescription_1.campaignFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ContactListDescription_1.contactListOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ContactListDescription_1.contactListFields"}]


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

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

  # Filter

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

  ## Node parameters

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

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

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

  ### Combining conditions

  You can choose to keep items:

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

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

  ## Node options

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

  ## Templates and examples

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

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

workflow_examples:
  [{"name":"chat_with_google_sheets_docs_version","workflow":{"name":"Chat with Google Sheets (docs version)","nodes":[{"parameters":{},"id":"e96a5e41-f0d6-49c1-977e-ff724a857212","name":"Execute Workflow Trigger","type":"n8n-nodes-base.executeWorkflowTrigger","position":[540,1240],"typeVersion":1},{"parameters":{"content":"### Sub-workflow: Custom tool\nThe agent above can call this workflow. It returns three different types of data from the Google Sheet, which can be used together for more complex queries without returning the whole sheet (which might be too big for GPT to handle).","height":612.0936015224503,"width":1449.2963504228514,"color":7},"id":"67facef0-e9c6-4280-8232-78f654b420d5","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[461.9740563285368,970.616715060075],"typeVersion":1},{"parameters":{"content":"### Main workflow: AI agent using custom tool","height":486.5625,"width":927.5,"color":7},"id":"bc448102-954b-451e-9bf7-bcadbc53bdbc","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[460,460],"typeVersion":1},{"parameters":{"content":"## Try it out\n\nSelect **Chat** at the bottom and enter:\n\n_Which is our biggest customer?_","height":183.85014518022527,"width":185.9375,"color":4},"id":"afb2da2f-8da2-4ee8-bff9-55a99eeecc5c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[300,540],"typeVersion":1},{"parameters":{},"id":"5d56d128-9a83-45ee-a34c-bc1190d59322","name":"Chat Trigger","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[600,560],"webhookId":"e3f23177-c7c1-417b-a513-1c1090dda0a2","typeVersion":1},{"parameters":{"authentication":"serviceAccount","documentId":{"__rl":true,"mode":"url","value":"={{ $json.sheetUrl }}"},"sheetName":{"__rl":true,"mode":"url","value":"={{ $json.sheetUrl }}"},"options":{}},"id":"3c0e4b48-a27b-472f-948e-9aa001c49149","name":"Get Google sheet contents","type":"n8n-nodes-base.googleSheets","position":[980,1240],"typeVersion":4.2},{"parameters":{"fields":{"values":[{"name":"sheetUrl"}]},"options":{}},"id":"67f9c172-e70f-4a0f-afd3-513cfeae09db","name":"Set Google Sheet URL","type":"n8n-nodes-base.set","position":[760,1240],"typeVersion":3.2},{"parameters":{"fields":{"values":[{"name":"response","stringValue":"={{ Object.keys($json) }}"}]},"include":"none","options":{}},"id":"d49223eb-2927-4ddd-bd2c-cd439f927341","name":"Get column names","type":"n8n-nodes-base.set","position":[1440,1060],"executeOnce":true,"typeVersion":3.2},{"parameters":{"jsCode":"return {\n  'response': JSON.stringify($input.all().map(x => x.json))\n}"},"id":"37ceba7a-1f0b-4de7-ae4a-d29a18dabaf6","name":"Prepare output","type":"n8n-nodes-base.code","position":[1720,1240],"typeVersion":2},{"parameters":{"name":"list_columns_tool","description":"=### List all column names in customer data\nThis is useful to find out what data is available for each customer. Returns a JSON array containing all the column names.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"column_names"}]}},"id":"94516eb1-89fc-4d3f-8000-d0fa43cd71cd","name":"List columns tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[940,780],"typeVersion":1},{"parameters":{"name":"get_customer_tool","description":"=### Get all columns for a given customer\nTo use this mode, pass the row number of the customer. Returns a JSON object with all the column names and their values.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"row"}]}},"id":"006745a1-3df7-4de9-9483-c6e133272c55","name":"Get customer tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[1220,780],"typeVersion":1},{"parameters":{},"id":"c3d20569-1374-4f8d-8779-23b98952d124","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[800,780],"typeVersion":1.1},{"parameters":{"name":"column_values_tool","description":"=### Get the specified column value for all customers\nThis is useful if you want to find out which customers have a certain value for a given column. Returns an array of JSON objects, one per customer. Each JSON object includes the column being requested, plus the row_number column. (The row_number column can be used to request the full customer data in a second step.). To use this mode, pass the name of the column to fetch.\n\nYou may want to call the 'list columns' tool first to find out which columns you could be fetching.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"column_values"}]}},"id":"3a370ae9-eaf8-4e84-948b-848c461ac9eb","name":"Get column values tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[1080,780],"typeVersion":1},{"parameters":{"text":"={{ $json.chatInput }}","options":{"maxIterations":10}},"id":"8f2a4854-2177-4ac8-9501-fa36cf2a3d73","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[820,560],"typeVersion":1.1},{"parameters":{"content":"**These tools all call the sub-workflow below**","height":179.21380662202682,"width":432.3271051132649,"color":5},"id":"2576563b-a104-4d99-b3c8-b53bff4c740c","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[900,740.8693557231958],"typeVersion":1},{"parameters":{"content":"**Change the URL of the Google Sheet**","height":226.64416053838073,"width":179.99762227826224,"color":2},"id":"5b623d9e-e188-403d-a702-9ece6172a487","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[723,1172],"typeVersion":1},{"parameters":{"model":"gpt-4","options":{"temperature":0}},"id":"2b8c8a67-a4df-4f5c-8c13-3cb2d25d2c5f","name":"GPT4 Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[660,780],"typeVersion":1},{"parameters":{"content":"**Set your credentials**","height":171,"width":150,"color":2},"id":"f39d0c9b-4055-4331-83c8-3dbffb43478e","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[620,720]},{"parameters":{"content":"**Set your credentials**","height":237,"width":176,"color":2},"id":"a8e09ef8-4dc6-4918-9194-047de402a8fa","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[940,1172]},{"parameters":{"content":"## Next steps\n\nLearn more about [Advanced AI in n8n](https://docs.n8n.io/advanced-ai/)","height":126.0084096222716,"width":291.1204551358572},"id":"a391dfb1-f408-4498-99cd-d35a258d6c9a","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[1740,1540]},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"column_names","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"col names"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"9fe58592-72e2-4379-9bdb-10da19c8218b","leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"column_values","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"col values"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"c1836f93-7874-43a4-98ff-cc487b276600","leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"row","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"rows"}]},"options":{}},"id":"907deea9-26cc-427e-93fc-52ce6b67e5e1","name":"Check operations","type":"n8n-nodes-base.switch","typeVersion":3,"position":[1220,1240]},{"parameters":{"fields":{"values":[{"name":"={{ $('Execute Workflow Trigger').item.json.query }}","stringValue":"={{ $json[$('Execute Workflow Trigger').item.json.query] }}"},{"name":"row_number","stringValue":"={{ $json.row_number }}"}]},"include":"none","options":{}},"id":"f2ebcae6-3cfb-4862-a927-dc66bd24f197","name":"Prepare column data","type":"n8n-nodes-base.set","position":[1440,1240],"typeVersion":3.2},{"parameters":{"conditions":{"options":{"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"bf712098-97e4-42cb-8e08-2ee32d19d3e7","operator":{"type":"number","operation":"equals"},"leftValue":"={{ $json.row_number }}","rightValue":"={{ $('Execute Workflow Trigger').item.json.query }}"}]},"options":{"looseTypeValidation":true}},"id":"f40acb04-ef06-4670-b8b1-86b04f066af8","name":"Filter out other rows","type":"n8n-nodes-base.filter","position":[1440,1420],"typeVersion":2}],"pinData":{},"connections":{"GPT4 Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Get column names":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Get customer tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"List columns tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Set Google Sheet URL":{"main":[[{"node":"Get Google sheet contents","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Get column values tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Set Google Sheet URL","type":"main","index":0}]]},"Get Google sheet contents":{"main":[[{"node":"Check operations","type":"main","index":0}]]},"Check operations":{"main":[[{"node":"Get column names","type":"main","index":0}],[{"node":"Prepare column data","type":"main","index":0}],[{"node":"Filter out other rows","type":"main","index":0}]]},"Prepare column data":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Filter out other rows":{"main":[[{"node":"Prepare output","type":"main","index":0}]]}}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.filter","version":2,"parameters":{"conditions":{"options":{"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"bf712098-97e4-42cb-8e08-2ee32d19d3e7","operator":{"type":"number","operation":"equals"},"leftValue":"={{ $json.row_number }}","rightValue":"={{ $('Execute Workflow Trigger').item.json.query }}"}]},"options":{"looseTypeValidation":true}},"position":[1440,1420]}],"connections":{"GPT4 Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Get column names":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Get customer tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"List columns tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Set Google Sheet URL":{"main":[[{"node":"Get Google sheet contents","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Get column values tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Set Google Sheet URL","type":"main","index":0}]]},"Get Google sheet contents":{"main":[[{"node":"Check operations","type":"main","index":0}]]},"Check operations":{"main":[[{"node":"Get column names","type":"main","index":0}],[{"node":"Prepare column data","type":"main","index":0}],[{"node":"Filter out other rows","type":"main","index":0}]]},"Prepare column data":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Filter out other rows":{"main":[[{"node":"Prepare output","type":"main","index":0}]]}},"source":"docs/_workflows/advanced-ai/examples/chat_with_google_sheets_docs_version.json"}]

troubleshooting_info:
  [{"issue":"Node parameters","solution":"Create filter comparison **Conditions** to perform your filter."},{"issue":"Combining conditions","solution":"You can choose to keep items:"},{"issue":"Node options","solution":"- **Ignore Case**: Whether to ignore letter case (turned on) or be case sensitive (turned off).\n- **Less Strict Type Validation**: Whether you want n8n to attempt to convert value types based on the operator you choose (turned on) or not (turned off). Turn this on when facing a \"wrong type:\" error in your node."}]

node_connections:
  [{"fromNode":"GPT4 Model","toNode":"AI Agent","connectionType":"ai_languageModel"},{"fromNode":"Chat Trigger","toNode":"AI Agent","connectionType":"main"},{"fromNode":"Get column names","toNode":"Prepare output","connectionType":"main"},{"fromNode":"Get customer tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"List columns tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Set Google Sheet URL","toNode":"Get Google sheet contents","connectionType":"main"},{"fromNode":"Simple Memory","toNode":"AI Agent","connectionType":"ai_memory"},{"fromNode":"Get column values tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Execute Workflow Trigger","toNode":"Set Google Sheet URL","connectionType":"main"},{"fromNode":"Get Google sheet contents","toNode":"Check operations","connectionType":"main"},{"fromNode":"Check operations","toNode":"Get column names","connectionType":"main"},{"fromNode":"Check operations","toNode":"Prepare column data","connectionType":"main"},{"fromNode":"Check operations","toNode":"Filter out other rows","connectionType":"main"},{"fromNode":"Prepare column data","toNode":"Prepare output","connectionType":"main"},{"fromNode":"Filter out other rows","toNode":"Prepare output","connectionType":"main"}]

example_workflow:
  {"name":"Filter Example Workflow","nodes":[{"parameters":{"conditions":{},"combineConditions":"AND"},"id":"gavtlu60wp9ygpopb7q24c","name":"Filter","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Conditions","name":"conditions","type":"fixedCollection","default":"{","description":"The type of values to compare","placeholder":"Add Condition"},{"displayName":"Combine Conditions","name":"combineConditions","type":"options","default":"AND","description":"Items are passed to the next node only if they meet all the conditions","options":[{"name":"AND","value":"AND","description":"Items are passed to the next node only if they meet all the conditions"},{"name":"OR","value":"OR","description":"Items are passed to the next node if they meet at least one condition"}]}]


