> For the complete documentation index, see [llms.txt](https://docs.uibakery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uibakery.io/extras/automations/using-external-node-libraries.md).

# Using external Node libraries

External libraries enhance the functionality of your UI Bakery app by allowing you to use a*dditional JavaScript code*. You can take advantage of a vast number of JavaScript libraries to bring date manipulation, data parsing, and much more into your automations.

## Finding libraries

1. Go to the [npm website](https://www.npmjs.com/) and search for a package, for example *XML parsing*, to find the libraries you need.
2. Select a library from the search results to view its *Details* page.
3. Click on the **Versions** tab at the top.&#x20;

{% hint style="info" %}
It is recommended to use the **most recent stable version** listed.
{% endhint %}

4. Here, copy the *package name* and *version number* and paste them in the **Packages** tab of the Automations page in the following format:

`"xml2js": "^0.6.2"`

{% hint style="warning" %}
Libraries dependent on the `fs` and `child_process` modules are currently not supported.
{% endhint %}

{% @arcade/embed flowId="GqHQbFl4jSwXPfiNpexU" url="<https://app.arcade.software/share/GqHQbFl4jSwXPfiNpexU>" %}

## Using libraries in your code

After adding the package number and version, you simply need to use `import` statements to include the library in your Automations. Below is an example of an *xml2js* library added to the Automation action:

```javascript
import { parseString } from 'xml2js';

// Or use result of other steps, for example, HTTP request as const xml = {{data}}
const xml = `<note>
  <to>User</to>
  <from>Library</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>`;

return new Promise((resolve, reject) => {
  parseString(xml, (err, result) => {
    if (err) {
      reject(err);
    } else {
      resolve(result);
    }
  });
});
```

{% @arcade/embed flowId="eREtTejTKkUHr9omZG7x" url="<https://app.arcade.software/share/eREtTejTKkUHr9omZG7x>" %}

### `require()` imports

`require()` imports are not supported in the Automations runtime. You should use the ES6 module import syntax instead. \
For modules using CommonJS *require*, replace it with an ES6 `import` statement.

**Before:**

`const yaml = require('js-yaml');`

**After:**

`import yaml from 'js-yaml';`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uibakery.io/extras/automations/using-external-node-libraries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
